rsync deleting files despite --dry-run

757 views Asked by At

When I run rsync with --delete and --dry-run specified, deleted local files are actually deleted on the remote. Command output includes (DRY RUN) at the end, but the remote files are deleted. Command I'm running:

rsync \
    -azv --dry-run --delete \
    -e "ssh -l backup -i /home/user/.ssh/id_backup" \
    --include-from='/home/user/.rsync-include.txt' \
    --exclude-from='/home/user/.rsync-exclude.txt' \
    /home/user backup:storage/backups/home

Sample output:

sending incremental file list
deleting user/zxcv
deleting user/asdf
user/

sent 7,091 bytes  received 62 bytes  4,768.67 bytes/sec
total size is 97,628,177  speedup is 13,648.56 (DRY RUN)

(note the (DRY RUN) at the end)

But on the remote server, the files that were there are deleted. What's happening here?

1

There are 1 answers

0
Trevithick On BEST ANSWER

This was the result of specifying a command="[rsync command]" in ssh's authorized_keys file on the remote machine. That command didn't include the --dry-run option. Changing options on the local machine doesn't work properly when the command is restricted by the command= ssh option on the remote machine.