-   Linux - Software (
-   -   rsync + ssh almost got it! But having a wierd problem :( (

neyoung 02-20-2007 10:47 PM

rsync + ssh almost got it! But having a wierd problem :(
Everything works fine and my null passphrase key works if I just use ssh... ie

$ ssh -i ~/.ssh/id_dsa_nullkey user@host

ssh connects right up without a password or anything just how I want it to. But, when I try to connect with rsync its a different story. I'm using the following command...

$ /usr/bin/rsync -navz ~/backup/ -e "ssh -i ~/.ssh/id_dsa_nullkey" user@host:backup/

This spits out the following error

Warning: Identity file ~/.ssh/id_dsa_nullkey not accessible: No such file or directory.

I'm then asked for my password as if I was logging in without the id_dsa_nullkey identity. I have the in the ~/.ssh/ directory with the permission set to 600 on both the local and remote machines.

In case it matters I created the key using the following command.

$ ssh-keygen -t dsa -f id_dsa_nullkey

I'm kinda lost at this point. It doesn't make sense to me how ssh can work just fine, but rsync won't. Any suggestions?

prozac 02-20-2007 10:59 PM

What happens when you do this?

$ /usr/bin/rsync -navz -e ssh ~/backup host:backup/
Where host is the host running the rsync server and you run this code as the same ssh user who's public key is at the server.

cgjones 02-20-2007 11:00 PM

Is there a rsync user account?

neyoung 02-20-2007 11:14 PM

$ /usr/bin/rsync -navz -e ssh ~/backup host:backup/
building file list ... done

sent 101 bytes received 24 bytes 27.78 bytes/sec
total size is 20 speedup is 0.16

worked... but I think that would be syncing the files in the opposite order that I'm trying to do. Maybe I'm confused. I'm trying to sync the files off my computer to a remote server (ie. changed files will be uploaded from my machine to the remote machine). I'm running the rsync command from my computer. Would this be the correct usage?

And no, there isn't an rsync user on the machine. I only have a user account on the box.

prozac 02-21-2007 11:29 PM


$ /usr/bin/rsync -navz -e ssh ~/backup host:backup/
You run the command on your personal computer and it will incremental copy your backup directory to the remote server.

neyoung 02-22-2007 12:55 AM

cool, thats what I want. But its not using the key ssh key that I created that doesn't use a password.

Ultimately what I'm trying to do is connect to the remote backup host with two different keys. One key I want to be asked for a password and will be the way that I normally connect to the remote host. The other key I want to use only for backup with rsync and thus shouldn't have a password. I'll be restricting the access of the key that doesn't have a password with a script called validate-rsync by placing it in the ~/.ssh/id_dsa_nullkey file.


command="~/validate-rsync" ssh-dss AAAAB3Nza
j2yBgN5cy8arlZ80q1Mcy763RjYGkR/FkLJ611HWIA= user@host

Here's the code in validate-rsync script



echo "Rejected"
echo "Rejected"
echo "Rejected"
echo "Rejected"
echo "Rejected"
echo "Rejected"
rsync\ --server*)
echo "Rejected"

The script basically disconnects you from the server if you try to do anything other than rsync. This script will always be run when the key that doesn't require a password is used. This will hopefully keep things fairly secure.

The process I'm trying to duplicate is documented in this article: <>

I still can't figure out why ssh will accept the identity file normally, but when ssh is used in conjunction with rsync it won't.

neyoung 02-22-2007 02:54 AM


$ /usr/bin/rsync -navz -e "ssh -i ~/.ssh/id_dsa_nullkey" ~/backup host:backup/

Warning: Identity file ~/.ssh/id_dsa_dreamhost_backup not accessible: No such file or directory.

and then asks for a password. I can't get it to recognize the identity file.

All times are GMT -5. The time now is 04:00 PM.