2

I am writing a bash script to rsync from one machine to another machine over ssh on LAN. It is giving me a link_stat error, and referencing a directory from which the source I am totally unsure of.

What is this error suggesting, and where is this path coming from in script??

the location of the Backup folder is /home/user/rsynctest/

#!/bin/bash
rsync -av ssh ../Backup/ 192.168.100.120:/media/storage1/Backup

the error...

    sending incremental file list
    rsync: link_stat "/home/user/rsynctest/Backup/ssh" failed: No such file or directory (2)

    sent 270 bytes  received 16 bytes  572.00 bytes/sec
    total size is 23  speedup is 0.08
    rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1183) [sender=3.1.1]
  • indications are that /home/user/rsynctest/Backup/ssh is a broken symlink; is that so? – Jeff Schaller Oct 4 '17 at 1:02
  • How does on determine this? – ScottF Oct 4 '17 at 1:11
2

You don't need to tell rsync to use ssh. It will use it by default when given a remote path. The "ssh" on your command line is interpreted as just another filepath to be copied. Since the rsync process can't find a file by that name, it complains (and then goes on and copies the next path given).

So change

rsync -av ssh ../Backup/ 192.168.100.120:/media/storage1/Backup

to

rsync -av ../Backup/ 192.168.100.120:/media/storage1/Backup
1

Try using the following,

rsync -av ../Backup/ -e ssh 192.168.100.120:/media/storage1/Backup 

OR

rsync -ave ssh ../Backup/ 192.168.100.120:/media/storage1/Backup 

Reason for not working:

When you are going to use ssh to transfer your files then you have to use the -e flag. From manpage,

-e, --rsh=COMMAND specify the remote shell to use

Here by using -e ssh you are specifying that you want to connect to the remote shell via ssh stream. If you want to know more how ssh works in rsync please check the following URL,

How does rysnc work over ssh?

  • Thanks. Where would an exclude flag go in that mix? – ScottF Oct 4 '17 at 1:47
  • I didn't change your command, just added -e ssh. So whatever you trying to do just add that part and it will work nicely. – muhammad Oct 4 '17 at 2:11

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.