CS 220 Parallel Computing

Setting up Passwordless ssh

We’ll be using a cluster of NVIDIA Jetson TK1 embedded development kits for MPI and GPU programming. To reach these machines, you must first ssh to stargate.cs.usfca.edu and then log into the nodes you want. The hostnames for these machines are jet01 – jet24 (jet01, jet02, jet03, etc. up to 24).

Passwordless ssh

To ease the MPI development process, you should set up passwordless ssh. Use ssh-keygen to generate a public and private ssh key pair:

[mmalensek@jet01]$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home4/mmalensek/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home4/mmalensek/.ssh/id_rsa
Your public key has been saved in /home4/mmalensek/.ssh/id_rsa.pub
The key fingerprint is:
(etc)

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

You can leave all of the prompts blank (including the password). Most people are okay with this approach, but you should know that doing so allows anyone who has your id_rsa file to log in as you. In other words, don’t share your id_rsa file (the public key, id_rsa.pub, is fine to share though). If you don’t want to do things this way, the alternative is using ssh-agent. See Using ssh-agent with ssh by Mark A. Hershberger to get you going.

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

You can also repeat this process on your own laptop and then copy the key over to stargate with:

ssh-copy-id mmalensek@stargate.cs.usfca.edu

(Replace mmalensek with your own username). This way you can log in from your laptop and bounce whereever you want to go without a password.

Transferring Files

You can also use the scp utility to copy files to the department machines. The basic usage looks like:

scp local-file.txt mmalensek@stargate.cs.usfca.edu:

Don’t forget the trailing : character. This tells scp to store the file in your home directory. You can also specify a remote file name, or store in a particular folder/directory:

scp local-file.txt mmalensek@stargate.cs.usfca.edu:other-name.txt
scp local-file.txt mmalensek@stargate.cs.usfca.edu:my_great_dir/subdirectory/

If you’d rather use a GUI to transfer the files, you have plenty of options:

When you configure these clients, set them up to use SFTP.

If you have checked your changes into GitHub, remember that you can use git clone to download your repository and git pull to pull in the latest changes. See the git guide for more information.