ssh automatic login with ssh-keygen

Link to comprehensive documentation on how to use ssh without having to provide a password for the remote node everytime

How to use ssh-keygen to generate a new SSH key

Basically the process is:

Generate a public and private key on your server. Do not enter a pass phrase

ssh-keygen -t rsa

Now copy the public key to the server you want to login to/ or execute commands against automatically without providing a password

cat ~/.ssh/id_rsa.pub | ssh user@remote-host 'cat >> ~/.ssh/authorized_keys
or
ssh-copy-id user@remote-host

and here is a screenshot of theĀ  overall process

test it by doing this:

ssh username@remoteHost
# or execute a command
ssh username@remotehost
e.g.
ssh username@remotehost id

ssh-keygen-screenshot-process

Leave a Comment

Scroll to Top