Passwordless ssh setup

If you want to use passwordless ssh login feature, you should use public key authentication mechanism.

To do this, remote server must be configured to enable public key authentication (enabled by default) and you should have an ssh public/private key and store your public key at the remote side’s special file: ~remote-user/.ssh/authorized_keys

Remote server setup: Check the following lines exists and uncommented in the /etc/ssh/sshd_config, if not you must add it and restart ssh server at the remote side:

RSAAuthentication yes
PubkeyAuthentication yes

Local setup: You must generate an public/private key pair for your own if it’s not generated before:

ssh-keygen -t rsa

You can select defaults just hitting enter a few times. After that your public key will be in the ~/.ssh/ file, you must add this file content’s to ~remote-user/.ssh/authorized_keys file. You can use scp to copy at the remote side and after that you can append contents into authorized_keys file at the remote side.

This is a trivial process and there is a special script utility which basically makes this copy and append task called ssh-copy-id:

ssh-copy-id remote-user@remote-host

Now, you can login without entering password.

If you require batch mode (password-less) login and want ssh to fail quickly without it, use these two options from the client side (see for descriptions of these):

$ ssh -o BatchMode=yes -o IdentitiesOnly=yes thehostname 

Or you can add it to a an ssh/config entry for .

Host thehostname
    IdentitiesOnly yes
    BatchMode yes