Difference between revisions of "Setting up SSH key authentication on Linux/UNIX"

From froelix.com - Wiki
Jump to: navigation, search
(Created page with ''''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:'''<BR> (Don’t ent…')
 
(added hint to ssh-copy-id)
 
(One intermediate revision by the same user not shown)
Line 14: Line 14:
 
  $ cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys2
 
  $ cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys2
 
  $ chmod 600 ~/.ssh/authorized_keys2
 
  $ chmod 600 ~/.ssh/authorized_keys2
 +
 +
'''Alternative to copy ssh id to server:'''
 +
$ ssh-copy-id -i .ssh/id_rsa.pub <user>@<server hostname>
 +
 +
'''More information (Solaris):'''
 +
 +
[http://docs.oracle.com/cd/E19253-01/816-4557/sshuser-33/index.html http://docs.oracle.com/cd/E19253-01/816-4557/sshuser-33/index.html]

Latest revision as of 15:27, 31 August 2016

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

Alternative to copy ssh id to server:

$ ssh-copy-id -i .ssh/id_rsa.pub <user>@<server hostname>

More information (Solaris):

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