Login through ssh or backup with rsync without password

There are a number of reasons why this would be useful. For me it was because I wanted to create an rsync backup job that would run every day at a certain time but I didn’t want the script to wait for me entering my password every time. Warning! This is a bit of a security risk so if you do this, it’s on you own risk.

1. First create a password file with ssh-keygen like this

ssh-keygen

(just press enter for every option until it’s done)

2. On this step, the “[email protected]” is set so the user that you want to log in as on the remote host is set. If you skip this, you will log in as the current user on your local machine

ssh-copy-id -i ~/.ssh/id_rsa.pub [email protected]

If you don’t have the ssh-copy-id command (on a mac) do the following:

curl https://raw.github.com/beautifulcode/ssh-copy-id-for-OSX/master/ssh-copy-id.sh -o /usr/local/bin/ssh-copy-id
chmod +x /usr/local/bin/ssh-copy-id

And don’t forget to thank beautifulcode

3. Now you should be ready. Try it out by typing

ssh [email protected]

1 Comment

  1. Great web site.. book a domain Many tips in this article. I am just delivering them to 3 buddies ans in addition expressing throughout scrumptious. And indeed, on account of a person’s sweating!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.