Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Editing code on the instructional machines


To make it easier to ssh into your account, first update your password:

Note: For all of the commands in which cs162-xxx is included, this refers to your autograder id.

ssh cs162-xxx@update.cs.berkeley.edu

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:

  1. Download and open Visual Studio Code.

  2. Open the Extensions tab on the left and search for “Remote - SSH”. Download the first result, which should have several million downloads. remote_ssh_extension

  3. Hit Cmd + Shift + P and type in “Remote-SSH: Connect to Host”, selecting the corresponding command. remote_ssh_command

  4. To make things easier in the future, select “Add New SSH Host”, put in ssh cs162-xxx@ashby.cs.berkeley.edu.

  5. On the next step, select the first option (which should be of the form ~/.ssh/config) as the SSH configuration to update.

  6. You may repeat steps 2-5 for 1-2 different hive machines since individual machines may be down at different times.

  7. Hit Cmd + Shift + P again 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.

  8. 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.

  9. 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. remote_ssh_open_folder

  10. 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.

  1. On your local terminal, type in cd ~/.ssh.

  2. Type ssh-keygen -t rsa in your terminal. Pick a custom file name you like when you are prompted to. We will use inst162 as the example here. You do not need a passphrase for the SSH key (hit return to skip the passphrase).

  3. Run ssh-copy-id -i inst162.pub cs162-xxx@ashby.cs.berkeley.edu. Enter your instructional account password when prompted.

  4. Hit Cmd + Shift + P in your Visual Studio Code and select “Open SSH Configuration File”.

  5. 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.