<<
Ssh Public Key Authorization
Here is how to set up public key SSH authentication, instead of password based authentication:
On your local machine, run :
ssh-keygen -t rsa
Save the key to
~/.ssh/id_rsa
Enter a passphrase, if required, or leave blank
copy the key to the remote machine, and secure the authorization file:
cat ~/.ssh/id_rsa.pub | ssh remoteuser@remoteserver "mkdir -m 700 -p ~/.ssh ; cat - >> ~/.ssh/authorized_keys ; chmod 600 ~/.ssh/authorized_keys"
This single step does 3 things on the remote server:
1 - creates the
~/.ssh directory if it doesn't exist.
2 - appends your public to the end of the
authorized_keys file.
3 - sets the appropriate permissions to the
authorized_keys file.
The remote
.ssh directory MUST be
chmod 700 - ssh will ignore the files if it is publicly readable.