2

I RTFMed rsync to the bone, but I just cannot figure out what I'm doing wrong here. I'm trying to sync two folders across SSH. Folders are identical save for one file, as you can see here:

nick@rilmir-laptop:~$ ssh -i .ssh/rilmir_passless nick@rilmir ls -l /home/nick/foobar/
total 2540
-rwxrwxrwx 1 nick nick 427676 Jan 19  2008 P1010001.JPG
-rwxrwxrwx 1 nick nick 431335 Jan 19  2008 P1010002.JPG
-rwxrwxrwx 1 nick nick 432706 Jan 19  2008 P1010003.JPG
-rwxrwxrwx 1 nick nick 431954 Jan 19  2008 P1010004.JPG
-rwxrwxrwx 1 nick nick 420208 Jan 19  2008 P1010005-rilmir.JPG
-rwxrwxrwx 1 nick nick 420208 Jan 19  2008 P1010005.JPG
nick@rilmir-laptop:~$ ls -l /home/nick/foobar/
total 2540
-rw------- 1 nick nick 427676 Sij 19  2008 P1010001.JPG
-rw------- 1 nick nick 431335 Sij 19  2008 P1010002.JPG
-rw------- 1 nick nick 432706 Sij 19  2008 P1010003.JPG
-rw------- 1 nick nick 431954 Sij 19  2008 P1010004.JPG
-rw------- 1 nick nick 420208 Sij 19  2008 P1010005.JPG
-rw------- 1 nick nick 420208 Sij 19  2008 P1010005-laptop.JPG

So, now I try rsyncing them, and what I get is the whole host directory, as if rsync did not connect to the remote.

nick@rilmir-laptop:~$ rsync -avz --dry-run -e "ssh -i .ssh/rilmir_passless nick@rilmir:/home/nick/foobar/"  /home/nick/foobar/
sending incremental file list
drwxrwxr-x          4,096 2014/08/27 20:00:08 .
-rw-------        427,676 2008/01/19 15:13:12 P1010001.JPG
-rw-------        431,335 2008/01/19 15:13:12 P1010002.JPG
-rw-------        432,706 2008/01/19 15:13:12 P1010003.JPG
-rw-------        431,954 2008/01/19 15:13:12 P1010004.JPG
-rw-------        420,208 2008/01/19 15:13:12 P1010005-laptop.JPG
-rw-------        420,208 2008/01/19 15:13:12 P1010005.JPG

sent 138 bytes  received 449 bytes  1,174.00 bytes/sec
total size is 2,564,087  speedup is 4,368.12 (DRY RUN)
nick@rilmir-laptop:~$ 

My google-fu has failed me, I just cannot figure out why this fails. Any ideas?

Edit:
Yes, I know this is dry run, that is on purpose while testing.

3
  • rsync by default runs over ssh if you specify remote location as user@host:/path/to/dir, you shouldn't provide ssh command. Also you are running in dry-mode, that means that there will be no actual changes in work of rsync command. – Navern Aug 27 '14 at 18:27
  • 1
    I think the dry run is telling you it wants to make permissions changes to all the files - the a option is archive mode which preserves permissions. – John Aug 27 '14 at 18:27
  • You could try without appending slash on the source folder and/or target folder. I had this issue once, and having the target postfixed with a slash means sync into that folder, instead of actually sync that folder. – 7ochem Dec 12 '16 at 8:24
3

Remove dry-run (it means to just "simulate"), as well as use a proper format for the ssh parameters.

rsync -avz -e "ssh -i .ssh/rilmir_passless" nick@rilmir:/home/nick/foobar/ /home/nick/foobar/

By the way, this brings the remote contents to the local side. You may want --delete to remove stuff that is on the dest but not on the source.

2
  • I'm sure I tried that format for ssh parameters sometime during debugging, but I obviously didn't because now everything works. Thanks! – dijxtra Aug 27 '14 at 18:57
  • Ok, if it works, please make sure you accept the answer for future reference. – Florin Asăvoaie Aug 27 '14 at 19:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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