Sunday, June 5, 2016

SSH Password-less Login - Using Key Authentication

You can login to a remote Linux server without entering password, using ssh-keygen and ssh-copy-id as explained in this article.

ssh-keygen creates the public and private keys. ssh-copy-id copies the local-host’s public key to the remote-host’s authorized_keys file. ssh-copy-id also assigns proper permission to the remote-host’s home, ~/.ssh, and ~/.ssh/authorized_keys.

Create public and private keys using ssh-key-gen on local-host.

$~: sudo ssh-keygen -b 4096

Copy the public key to remote-host using ssh-copy-id.

$ ssh-copy-id -i ~/.ssh/id_rsa.pub remote-host

Done..

No comments:

Post a Comment