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]
2
  • indications are that /home/user/rsynctest/Backup/ssh is a broken symlink; is that so?
    – Jeff Schaller
    Oct 4, 2017 at 1:02
  • How does on determine this?
    – Scorb
    Oct 4, 2017 at 1:11

2 Answers 2

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?

2
  • Thanks. Where would an exclude flag go in that mix?
    – Scorb
    Oct 4, 2017 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.
    – arif
    Oct 4, 2017 at 2:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .