Link Search Menu Expand Document

Editing code in your VM

Table of contents

  1. Using the SMB server
    1. Windows
    2. macOS
    3. Linux
  2. Using VSCode’s remote ssh feature

The VM contains a SMB server that lets you edit files in the vagrant user’s home directory. With the SMB server, you can edit code using text editors on your host and run git commands from inside the VM. This is the recommended way of working on code for this course.

Alternatively, if you use VSCode, you can use its remote ssh feature to connect to your VM quite easily. This process is detailed below.

These are two suggested ways to edit code in your VM, but you are free to do whatever suits you best. Another possibility is just using a non-graphical text editor in an SSH session.

Using the SMB server

Windows

  1. Open the file browser, and press Ctrl L to focus on the location bar.

  2. Type in \\192.168.162.162\vagrant and press Enter.

  3. The username is vagrant and the password is vagrant.

You should now be able to see the contents of the vagrant user’s home directory.

macOS

  1. Open Finder.

  2. In the menu bar, select Go → Connect to Server….

  3. The server address is smb://192.168.162.162/vagrant.

  4. The username is vagrant and the password is vagrant.

You should now be able to see the contents of the vagrant user’s home directory.

Linux

Use any SMB client to connect to the /vagrant share on 192.168.162.162 with the username vagrant and password vagrant. Your distribution’s file browser probably has support for SMB out of the box, so look online for instructions about how to use it.

Using VSCode’s remote ssh feature

The following instructions are for macOS, but the process should be very similar for other OSes.

  1. Change into the directory of your vm: cd cs162-vm.

  2. Make sure the machine is up and running: vagrant up.

  3. Append the machine’s ssh config to your system’s ssh config: vagrant ssh-config >> ~/.ssh/config.

  4. Head over to VSCode and open up the command palette (cmd-shift-P).

  5. Select “Remote-SSH: Connect to Host”.

  6. Select default option.