221的lab和project本地运行，可以通过cs remove server编译，但需要分别下载SHELL(链接cs remote)和FTP(文件上传)，比较麻烦。这里介绍一个用 visual studio 搭建ssh连cs remote的本地运行设置。
Follow the first three installation steps here.
If you're not sure how to check if you already have an SSH client, open up a terminal (in VS Code, you can do this by pressing Ctrl + Shift + `), type in ssh, then press enter. If it gives you an error saying something along the lines of "command not found", etc., then you need to install one. Otherwise, you're set.
From here, everything should work, but you'll have to enter your CWL credentials each time you connect to the server. To get around this, you can set up an SSH profile and switch to key-based authentication. Follow the steps below if you don't know-how:
Inside VS Code, press F1, and select "Remote-SSH: Connect to Host...", then select "Configure SSH Hosts...". Select the first option. A file should pop up. Add an entry to the file (example below), and save.
Generate an SSH key. Run ssh-keygen in a (local) terminal instance. Whenever you're prompted, you can just press enter to accept the defaults.
Copy your public SSH key to the server. If you used the default location, use the following command:
cat ~/.ssh/id_rsa.pub | ssh remote 'cat >> ~/.ssh/authorized_keys'
If you’re on Windows you could manually copy the public key, use the windows subsystem for Linux, or get access to Unix tools some other way. cat is a Unix tool so it’s not available on Windows.
From here, you should be edit to edit code directly off of the server in your editor, and also open remote terminal instances in your editor as well.
You can download files directly to the remote servers using wget. For example, if I wanted to download the starter files for lab 1, I would run:
Please avoid installing a bunch of extensions on the server (locally is fine). The last thing we want is for some rogue extensions to be eating up the server's resources.
folder '.ssh/' 在哪？
In a local terminal:
mkdir -p ~/.ssh
Run wget in a remote terminal to download files directly onto the remote server. This just saves you from having to download to your own machine then transfering to the remote server.
“The authenticity of host 'remote.students.cs.ubc.ca ' can't be established.” Host key verification failed.
It should ask you if you want at the host key to your known_hosts file, but you can add it manually with:
ssh-keyscan -t rsa -H remote.students.cs.ubc.ca >> ~/.ssh/known_hosts
in stept 5, what does it mean to copy public key to server?
Server is the remote you connect to, eg remote.students.cs.ubc.ca.
Your public key is a public part of the ssh keypair you send to the server in order to authenticate you. It is analogous to using a text password, but when you use keys you no longer need to input a password.
It’s stored in /.ssh/id_rsa.pub in the example above.
You can also replace step 5 with:
After the first part of step 5 "cat......", what should I do so that I can save the time of uploading my files.
F1 -> Remote-SSH: Connect to Host...
"Warning: No xauth data; using fake authentication data for X11 forwarding."
You likely don't have the xauth binary set in your ssh config. It doesn't really make any functional difference but if you are concerned you can add the following to the ssh command.
ssh -Y -o XAuthLocation=$(which xauth) remote.students.cs.ubc.ca
If xauth is not in your path you can set it manually, assuming this path is the correct location of your binary:
ssh -Y -o XAuthLocation=/opt/X11/bin/xauth remote.students.cs.ubc.ca
If you don't want to set it every time you can also put it in your /.ssh/config under a specific host or globally:
Still got the warning to disappear using the first command, but I don't understand how to do the final step. I put the commands in the terminal and it didn't work. How do I alter the /.ssh/config?
mkdir -p ~/.ssh
nano ~/.ssh/config # Add config here