Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This is how I am currently doing it:

# ssh-keygen -t dsa -b 1024 -f /root/localhost-rsnapshot-key

Enter passphrase (empty for no passphrase): [press enter here]
Enter same passphrase again: [press enter here]

# if [ ! -d ~/.ssh ]; then mkdir ~/.ssh ; chmod 700 ~/.ssh ; fi
# cd ~/.ssh/
# if [ ! -f config ]; then touch config ; chmod 600 config ; fi
# echo Host server2 >> config
# echo Hostname server2.domain.tld >> config
# echo IdentityFile /root/localhost-rsnapshot-key >> config

Now when I run rsnapshop like:

backup  server2@server2.domain.tld:/home/     localhost/server2/

I get the following:

rsnapshot hourly
reverse mapping checking getaddrinfo for server2-domain-tld.1-2-3-4 [] failed - POSSIBLE BREAK-IN ATTEMPT!
server2@server2.domain.tld's password:

Is there a way to make this run without a password?

share|improve this question
up vote 3 down vote accepted

You can run the command ssh-copy-id server2@server2.domain.tld from server1 to copy your identity file to the remote system and allow pubkey authentication. You may also need to make sure key-based authentication is enabled in your sshd config.

share|improve this answer

On server2, you need to add the generated public key to /root/.ssh/authorized_keys

share|improve this answer

Assuming you want to authenticate into a shell account named 'server2' on a host named 'server2', you need to add the contents of generated on server1 to the server2:/home/server2/.ssh/authorized_keys file.

share|improve this answer

First off, please consider using rsa keys instead of dsa although I know this is unsolicited advice, rsa is more secure than dsa, unless of course you have a compelling reason to do so.

Let me start by saying I will do this using standart unix command like scp, cat, chmod, chown and such instead of using more esoteric commands, likes of ssh-copy-id. So that you can use it on pretty much any Unix flavor, not only Linux.

Getting these out of the way after running the ssh-keygen command, you have two files in your .ssh directory:


# on the local machine which will connect the remote server without a password

cd ${HOME}/.ssh
# if this errors out, you might need to create the .ssh on the remote server

# on the remote machine which will accept incoming ssh connection without a password
chown ${REMOTE_USER} ${REMOTE_USER_HOME}  # this should already be set like this
chown ${REMOTE_USER} ${REMOTE_USER_HOME}/.ssh # if this exists, it should be this way

chmod 700 ${REMOTE_USER_HOME}
chmod 700 ${REMOTE_USER_HOME}/.ssh

cat >> ./authorized_keys
chown ${REMOTE_USER} ./authorized_keys
chmod 600 ./authorized_keys

Now, you should be able to connect to the remote machine without a password.

hope this helps.

share|improve this answer

Though it's already explained up in above few answers, but if you looking for more details, you can refer to this article.

Password-Less Login

share|improve this answer
Welcome to Server Fault! We really do prefer that answers contain content not pointers to content. Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. – Iain Dec 4 '12 at 18:29

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.