Working Remotely

Regardless of whether you see yourself working in a career focused on Operating Systems, the skills you will learn working remotely with a Unix-based OS will be extremely useful later on. It is important to pick up basic command line skills, and you should also be comfortable making changes to files remotely using a text-based editor.

This page outlines some of the techniques you can use to make your life easier while working remotely. If it isn’t easy to start working, then you’ll never get started.

Working From Home

To access campus resources from home, you’ll need to use the USF VPN. Once installed and connected, you can access the CS servers as you would on campus.

Text Editors

The three most common terminal-based editors you’ll hear about are nano, vim, and emacs. It is strongly recommended that you learn the basics of at least one because you never know when they’ll come in handy. nano is the easiest: it has a helpful menu at the bottom to remind you of keybindings, uses the arrow keys to navigate, etc. However, it is not very powerful without quite a bit of customization.

Finally, a note. While using a terminal-based text editor is not required in class, you should consider learning the basics over the course of the semester. Some students go all-in on vim, emacs, etc. and others stick to GUI-based editors on their local machine. Either way is fine. However, don’t let yourself get bogged down worrying so much about editors that you don’t actually work on the projects!

Setting up an ssh Alias

You can ssh directly to machines on the CS network without logging into our Jump Host, stargate, by setting up an alias. Edit ~/.ssh/config on your local machine (create it if it doesn’t exist already) and add the following:

ServerAliveInterval 120

Host gojira
    User CSUSERNAME
    ProxyJump CSUSERNAME@stargate.cs.usfca.edu

NOTE 1: you can leave entries from your other classes (if any) in the file. No need to remove anything, we’re just adding the lines above.

NOTE 2: The ServerAliveInterval 120 line sends a null packet every 120 seconds to keep your SSH connection alive.

Test out the connection by running ssh gojira on your local machine. You’ll need to type in your password twice unless you have ssh keys set up on the CS network. To fix this, continue on to the next section.

Passwordless ssh between department machines

While using a password or password-protected ssh key is a good idea to gain access to the CS network, once you are logged in it tends to be more convenient to be able to ssh to any machine without typing your password. Log into any CS machine to set this up.

Do you already have an ssh key on the CS network?

Start by running ssh-keygen. If you see the following:

[matthew@gojira:~]$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/mmalensek/.ssh/id_rsa): (press enter)
/home/mmalensek/.ssh/id_rsa already exists.
Overwrite (y/n)? n

Then you don’t need to create the key. Enter n to quit ssh-keygen. Otherwise, proceed:

# Note that I'm just hitting enter here to accept the defaults.
# For inter-CS machines, you can skip entering a password if you want.
[mmalensek@gojira]$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/mmalensek/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/mmalensek/.ssh/id_rsa
Your public key has been saved in /home/mmalensek/.ssh/id_rsa.pub
The key fingerprint is:
...
(fingerprint and randomart image display)
...

Once you have a key (either existing or just created), do the following to authorize it to be used throughout the CS network:

[mmalensek@stargate]$ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
[mmalensek@stargate]$ chmod 700 ~/.ssh
[mmalensek@stargate]$ chmod 600 ~/.ssh/authorized_keys

Since our lab machines have shared home directories, you can now log into any of the machines in the department without a password.