I got these errors while trying to perform a dry-run with option -n over ssh on a remote server:

# rsync --progress --delete -avhHen ssh /etc/yum root@my.ipaddress:/etc
rsync: Failed to exec n: No such file or directory (2)
rsync error: error in IPC code (code 14) at pipe.c(85) [sender=3.1.0]
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in IPC code (code 14) at io.c(226) [sender=3.1.0]

How do I perform a dry-run for the above command using rsync over ssh?

  • You need -e 'ssh -opts user@host' or to read the USING RSYNC-DAEMON FEATURES VIA A REMOTE-SHELL CONNECTION section in man rsync. You can use --dry-run or -n or --list-only for no-op tests. – mikeserv Jun 23 '14 at 2:28
rsync: Failed to exec n: No such file or directory (2)

Pretty much explains it there...

the -e option (long version: --rsh=) says to execute the FOLLOWING command as the shell on the destination machine.

You told it: -e n. Look at the order of the options you supplied. (-avhHen)

Reverse the order, ne so that your redundant use of -e ssh will work as you desire.

  • Ah.. I get what the error is trying to tell me now. Thanks a lot :) – Question Overflow Jun 23 '14 at 2:39
  • 1
    Just a minor comment: -e specifies the command to get to a remote shell from your local machine. Your answer can be misunderstood that -e specifies the path to a shell on the remote machine (e.g. /usr/bin/bash) -- which is wrong. – m8mble Aug 26 '18 at 16:21

The problem here is that rsync's -e option expects the remote shell as the very next "thing" on the command line: here, that's n, while before it was ssh.

Usually I'd split -e out as its own option and write this like:

rsync --progress --delete -avhHn -e ssh /etc/yum root@my.ipaddress:/etc

but you could also just move the n earlier - it's important that the e be the last option in a group of short options, if you're going to use it like that.

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.