SSH Login Without Password

It is common to use SSH and scp to communicate and transfer files with remove servers. Sometimes we want to SSH login without password, especially within a shell script.

Create an encryption key pair

Log into local server. Run ssh-keygen to create an encryption key pair, the public and private keys. Just hit (Enter or Return) button for the key and the passphrases. If you already have an SSH key, you can skip this step.

Copy the public key to the remote server

We still on the local server. Run ssh-copy-id to install the local server’s public key in a remote server’s authorized_keys.

If no ssh-copy-id 

Test

Try logging into the remote server with ssh without password

And check in ” .ssh/authorized_keys” to make sure we haven’t added extra keys that you weren’t expecting.

Leave a Reply

Your email address will not be published. Required fields are marked *