Hoffman2:Password-less Logins

From Center for Cognitive Neuroscience
Revision as of 16:10, 10 April 2017 by Dmargolis (talk | contribs) (Created page with "The steps below will show you how to login without typing your password every time! On your local computer: a@A:-> '''ssh-keygen -t rsa''' Generating public/private rsa key...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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

On your local computer:

a@A:-> ssh-keygen -t rsa
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 a's new public key to b@B:.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