OpenSSH public key accessSubmitted by valerio on Tue, 08/17/2010 - 09:55 |
This procedure allow to log-in to a ubuntu server with openssh without writing the password every time you access.
Generation of the key:
client$ mkdir ~/.ssh client$ chmod 700 ~/.ssh
client$ ssh-keygen -q -f ~/.ssh/id_rsa -t rsa
Enter passphrase (empty for no passphrase): …
Enter same passphrase again: …
Key protection on the client:
client$ chmod 700 ~/.ssh
client$ chmod go-rwx ~/.ssh/*
Copy of the public key on the server:
client$ scp ~/.ssh/id_rsa.pub <user>
@<server>:
Configuration of the public key on the server:
server$ mkdir ~/.ssh
server$ chmod 700 ~/.ssh
server$ cat ~/id_rsa.pub >> ~/.ssh/authorized_keys
server$ chmod 600 ~/.ssh/authorized_keys
server$ rm ~/id_rsa.pub
The command to be executed must be cat ~/id_rsa.pub >> ~/.ssh/authorized_keys and not with a single > wich will overwrite other public keys just present on the server.