We intend to use a cron task to rsync files from one machine to another. Requirements are simple:

  • File source is exactly one directory, and destination is one directory on the target machine
  • Must allow only simple files, no symlinks, no directories
  • And absolutely, positively no possibility of the transfer creating files anywhere else in the destination file system besides the intended directory.

Problem is, the description of options for rsync are mind-boggling, and not only do some options change the effect of others, but even the order of the options is important. (AaacK!)

Can anyone please help describe a set of rsync options that will only allow transferring simple files between specified source and target directories?

We even know the names of the files in advance if that's helpful or could make the process more secure. Is it overkill to use the filter option for this?

  • 1
    I think you should learn to read and decipher man pages. It's not hard and is a critical skill for sysadmins. – user591 Feb 10 '14 at 21:19

If you know the names of the files why don't you just list them in a text file and use the --files-from directive ?

--files-from=FILE read list of source-file names from FILE


You can try:

rsync -a --no-links -f"- */" -f"+ *" source/ destination/

Your Answer

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