Hoffman2:Password-less Logins

From Center for Cognitive Neuroscience
Jump to navigation Jump to search

Back to all things Hoffman2

The steps below will show you how to login without typing your password every time!

On your local computer:

a@A:-> ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/a/.ssh/id_rsa): [ENTER]
Created directory '/Users/a/.ssh'.
Enter passphrase (empty for no passphrase): [ENTER]
Enter same passphrase again: [ENTER]
Your identification has been saved in /Users/a/.ssh/id_rsa.
Your public key has been saved in /Users/a/.ssh/id_rsa.pub.
The key fingerprint is:
3e:4f:05:79:3a:9f:96:7c:3b:ad:e9:58:37:bc:37:e4 a@A

Now use ssh to create a directory ~/.ssh as user on Hoffman2. (The directory may already exist, which is fine):

a@A:~> ssh user@hoffman2.idre.ucla.edu mkdir -p .ssh
user@hoffman2.idre.ucla.edu's password: [PASSWORD]

Finally append your new public key to user@hoffman2.idre.ucla.edu:.ssh/authorized_keys and enter b's password one last time:

a@A:~> cat .ssh/id_rsa.pub | ssh user@hoffman2.idre.ucla.edu 'cat >> .ssh/authorized_keys'
user@hoffman2.idre.ucla.edu's password: [PASSWORD]

Now you can login to hoffman from local computer without a password!

a@A:~> ssh user@hoffman2.idre.ucla.edu