Skip to content

Instantly share code, notes, and snippets.

@nicholashoule
Last active June 6, 2019 19:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicholashoule/09d58014fc0280a3ff9afaf501431a64 to your computer and use it in GitHub Desktop.
Save nicholashoule/09d58014fc0280a3ff9afaf501431a64 to your computer and use it in GitHub Desktop.
Rsync and SSH

Rsync and SSH

PULL FROM REMOTE HOST (DOWNLOAD):
rsync -ravz -e ssh root@172.20.0.1:/opt/ /home/user/directory/
rsync -avz -e "ssh -A -i /home/user/.ssh/id_rsa" user@172.20.0.1:/data /home/user/projects/data
PUSH TO REMOTE HOST (UPLOAD):
rsync --help

Options
 -v, --verbose               increase verbosity
 -a, --archive               archive mode; equals -rlptgoD (no -H,-A,-X)
 -r, --recursive             recurse into directories
 -n, --dry-run               perform a trial run with no changes made
...
 -c, --checksum              skip based on checksum, not mod-time & size
 -u, --update                skip files that are newer on the receiver
 -z, --compress              compress file data during the transfer
 ...
 
rsync --update -ravz -e ssh /home/user/directory/ root@172.20.0.1:/opt/
rsync -avz -e "ssh -p 10010" /home/user/directory/ root@172.20.0.1:/opt/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment