Rsync copies my SSH key over when I don't want it to
I'm trying to use rsync to backup a directory from one machine to another, via SSH and a key. But it copies my private key over too - when I don't want it to.
I've tried '--exclude=keyname' but that just stops it from working altogether.
Here's my code:
Also, is this the correct code to get it to keep these two folders in sync? (basically a mirror of the folder on machine1 to the folder on the destination machine2).
Thanks in advance!
The --exclude option works for me.
I use pubkey authentication, and have the same credentials and uid on the target machine.
I just ran your command and transferred a directory from my laptop to my desktop:
rsync -ave "ssh" --exclude list1 work/ jschiwal@hpmedia:rsynctest/
Could you give the entire line you used with the --exclude option. I used the source directory ~/work as the base for the excluded files pathname. You concealed too much info to see if this was your problem.
Hi, thanks for the reply.
The line with exclude was:
The first bit of code I used works, but it copies the ssh key over too, but when I exclude the key I get this:
rsync -ave "ssh -i /home/accname1/.ssh/sshkey" /home/accname1/public_html/rsynctest email@example.com:/home/accname2/public_html/rsynctest/
The .ssh/id_rsa (or .ssh/sshkey) isn't among the files being synced.
This test worked for me as well:
rsync -ave "ssh" --exclude="list?" work/ jschiwal@hpmedia:rsynctest/
It excluded the files work/list1, work/list2 and work/list3.
Then I copied the list1, list2, list3 and listing files to work/test/ and ran rsync again. Only the "listing" file was replicated.
|All times are GMT -5. The time now is 03:25 AM.|