Setting up SSH key authentication on Linux/UNIX

From froelix.com - Wiki
Revision as of 14:43, 2 June 2016 by Froelix (Talk | contribs) (added link for solaris)

Jump to: navigation, search

Create the .ssh directory on the server (if it doesn't exist yet):

$ mkdir ~/.ssh
$ chmod 700 ~/.ssh

On the client run the following commands:
(Don’t enter a passphrase unless you want to type it every time you want to use the key)

$ ssh-keygen -t dsa
$ chmod 700 ~/.ssh
$ chmod 600 ~/.ssh/id_dsa
$ chmod 644 ~/.ssh/id_dsa.pub
$ scp ~/.ssh/id_dsa.pub <server hostname>:~/.ssh/

And on the server run these commands:

$ cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys2
$ chmod 600 ~/.ssh/authorized_keys2

More information (Solaris):

http://docs.oracle.com/cd/E19253-01/816-4557/sshuser-33/index.html