Instead of using password authentication, you can use SSH keys to authenticate with your account.

+

Instead of using a password, you can use SSH keys to authenticate with your account.

Run the following interactive command to generate an SSH key pair:

Run the following interactive command to generate an SSH key pair:

Line 69:

Line 77:

Generating public/private rsa key pair.

Generating public/private rsa key pair.

−

Enter file in which to save the key (/home/user/.ssh/id_ecdsa): '''<just hit enter>'''

+

Enter file in which to save the key (/home/user/.ssh/id_rsa): '''<just hit enter>'''

Enter passphrase (empty for no passphrase): '''<use a non-empty pass''phrase''>'''

Enter passphrase (empty for no passphrase): '''<use a non-empty pass''phrase''>'''

Enter same passphrase again:

Enter same passphrase again:

Line 89:

Line 97:

+-----------------+

+-----------------+

−

{{Note | please use a passphrase for your key. It should be ''multiple words'' (aka a phrase). Learn more about [https://help.github.com/articles/working-with-ssh-key-passphrases SSH key passphrases]. }}

+

{{Note | use a passphrase for your key, not a password. It should contain ''multiple words'' (i.e. a phrase). [https://en.wikipedia.org/wiki/Passphrase#Compared_to_passwords Learn more about passphrases]. ([http://xkcd.com/936/ relevant xkcd comic])}}

−

Now you should have two keys: a public key at <code>~/.ssh/id_rsa.pub</code> and an encrypted private key at <code>~/.ssh/id_rsa</code>. Do not share your private key with anybody. Your public key can be copied to any remote account that supports SSH and you will be able to use your private key to authenticate with it.

Now you should have two keys: a public key at <code>~/.ssh/id_rsa.pub</code> and a corresponding private key at <code>~/.ssh/id_rsa</code>. Do not share your private key with anybody. Your public key can be copied to any remote account that supports SSH and you will be able to use your private key to authenticate with it.

−

$ ssh-copy-id user@linux.ucla.edu

+

E.g. copy your public key to your LUG@UCLA account:

−

That's all!

+

$ ssh-copy-id user@ssh.linux.ucla.edu

+

+

Consider using <code>ssh-agent</code> so you don't have to type your passphrase every time you use your private key. In most modern desktop environments (e.g. GNOME, KDE) this is handled in a GUI pop-up when you first use your private key.

+

+

Type <code>man ssh-keygen</code>, <code>man ssh-copy-id</code>, or <code>man ssh-agent</code> to see the complete manuals for these tools.

Now you should have two keys: a public key at ~/.ssh/id_rsa.pub and a corresponding private key at ~/.ssh/id_rsa. Do not share your private key with anybody. Your public key can be copied to any remote account that supports SSH and you will be able to use your private key to authenticate with it.

E.g. copy your public key to your LUG@UCLA account:

$ ssh-copy-id user@ssh.linux.ucla.edu

Consider using ssh-agent so you don't have to type your passphrase every time you use your private key. In most modern desktop environments (e.g. GNOME, KDE) this is handled in a GUI pop-up when you first use your private key.

Type man ssh-keygen, man ssh-copy-id, or man ssh-agent to see the complete manuals for these tools.