New rsync remote host syntax

7 03 2014

Updated rsync syntax. This version accounts for symlinks and does a better job with file permissions, now that the source files are on a network drive:

rsync -v -r -u -l -e ssh --chmod=a+r,Dg+s,ug+w,o-w,+X,Fa-x --exclude-from=/path/to/skip.txt /path/to/mounted/network/drive netid@server.domain.url:/remote/destination

-v = verbose
-r = recursive
-u = update changed files only
-l = copy symlinks as symlinks
-e = specify remote shell (“ssh” in this example)
-chmod = affect file and/or directory permissions

  • a+r = all add read
  • Dg+s = Directories only, group add sticky bit
  • ug+w = owner/group add write
  • o-w = other remove write
  • +X = make a directory or file searchable/executable by everyone if it is already searchable/executable by anyone…
  • Fa-x = …but remove searchable/executable if it’s a file and not a directory

As before, you can also get a “dry run” to list changes (but not actually execute the change) by adding the -n flag:

rsync -v -r -u -l -n -e ssh --chmod=a+r,Dg+s,ug+w,o-w,+X,Fa-x --exclude-from=/path/to/skip.txt /path/to/mounted/network/drive netid@server.domain.url:/remote/destination


Actions

Information

Leave a Reply

Your email address will not be published. Required fields are marked *




Skip to toolbar