Note: Most of these instructions will work on Linux as well.
Keypair Authentication Setup
- In a terminal, run the command
ssh-keygen -t rsa
- Accept the default location for the key files.
- Enter a strong passphrase for your key. You will be prompted for it twice. Do not make this passphrase the same as your Brown password.
- Copy your public key to your desktop with the command
cp .ssh/id_rsa.pub Desktop
- Upload your public key to your keys page. Wait a few minutes for the gateway to recognize your key.
SSH regular use
- In a Terminal, run the command
ssh username@ssh.cs.brown.edu
(where username is your CS login). - You will receive a prompt that asks if you you're sure you want to connect (yes/no). Type yes and hit enter.
- Enter the passphrase you chose during setup.
- If this is your first time logging in, or you recently changed your University password, you will additionally be asked for your University password and Duo 2-factor auth. Subsequent logins will skip this step.
- You are now connected to a CS department computer.
- If you want to connect to a specific computer, for examble cslab6a, change the command to
ssh -t username@ssh.cs.brown.edu host=cslab6a
Using ssh-agent and the keychain
To add your SSH key to ssh-agent when you log in, and store the passphrase in your keychain, you can make the following change to the SSH configuration on your laptop or remote machine.
- Edit or create your
~/.ssh/config
file and add the following lines (substitute the name of your identity file):
Host ssh.cs.brown.edu
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_ed25519
FastX (for graphical sessions)
- To run programs with GUIs, like gedit, sublime, or Eclipse, the department recommends using FastX. The guide for FastX can be found here.
- If FastX is not working for whatever reason, please follow the instructions below to install XQuartz, which can be more robust.
Optional (In Case You Dislike FastX) - X11 Forwarding with XQuartz
If you want to stick with regular ssh and still run programs with GUIs written according to the X display protocol, like gedit or Eclipse, you need an X server. With most Linux distributions, this should work out of the box, but for Macs, you'll need to download an extra bit of software.
Start by downloading the program XQuartz here.
Once the install wizard finishes, log out of your personal computer and log back in to finish the installation process. XQuartz will not work properly unless you do so.
You can now use the OSX Terminal (search for 'Terminal' using Mac's Spotlight Search function to find it) and use that to ssh to the department machines. To do so:
- In the Mac Terminal, run the command
ssh -Y username@ssh.cs.brown.edu
(where username is your CS login). For Linux, substitute -X instead of -Y. - Enter your password.
- You are now connected to a CS department computer and can use graphical applications.