Editing code on the instructional machines
To make it easier to
ssh into your account, first update your password:
To remotely modify code, you will need to
ssh onto the machines. Visual Studio Code has a helpful remote development feature that streamlines the process of developing over
ssh. To set this up, follow the steps below:
Download and open Visual Studio Code.
Open the Extensions tab on the left and search for “Remote - SSH”. Download the first result, which should have several million downloads.
Cmd + Shift + Pand type in “Remote-SSH: Connect to Host”, selecting the corresponding command.
To make things easier in the future, select “Add New SSH Host”, put in
On the next step, select the first option (which should be of the form
~/.ssh/config) as the SSH configuration to update.
You may repeat steps 2-5 for 1-2 different hive machines since individual machines may be down at different times.
Cmd + Shift + Pagain and select “Remote-SSH: Connect to Host”. The hosts you set up earlier should now show up, so select the one you would like to connect to.
A new window should open up with a bright “Opening Remote” indicator in the bottom left. You will need to enter your password in the textbox that pops up at the top of the screen.
If your remote login was successful, you should now see “SSH: ashby.cs.berkeley.edu” in the bottom left corner.To edit your files, click on the Explorer tab at the top left of the window, then select “Open Folder”. Select “OK” to select your home folder (you can select other folders if you would like as well), then enter your password again.
You should now be able to edit any file you would like and have it sync with your remote machine! To disconnect, click on the “SSH: ashby.cs.berkeley.edu” label at the bottom right of the window, which should open up a panel of options including “Close Remote Connection”.
[Optional] Adding SSH public key to the instructional machines
If you would like to connect to instructional machines without entering your password every time, follow the steps below to add your SSH public key to the instructional machines.
On your local terminal, type in
ssh-keygen -t rsain your terminal. Pick a custom file name you like when you are prompted to. We will use
inst162as the example here. You do not need a passphrase for the SSH key (hit
returnto skip the passphrase).
ssh-copy-id -i inst162.pub email@example.com. Enter your instructional account password when prompted.
Cmd + Shift + Pin your Visual Studio Code and select “Open SSH Configuration File”.
Select the first option (which should be of the form
~/.ssh/config). You should see the following lines in the file:
Host ashby.cs.berkeley.edu HostName ashby.cs.berkeley.edu User cs162-xxx
Add two lines right after the above lines, so that it should look like:
Host ashby.cs.berkeley.edu HostName ashby.cs.berkeley.edu User cs162-xxx PreferredAuthentications publickey IdentityFile "~/.ssh/inst162"
Try connecting to the instructional machine in your Visual Studio Code. You should no longer need a password now.