Walk-in office hours
with Dr. Ryan Johnson,
Applications Scientist

Wednesdays 10 am to noon

26. How to Use Rsync

Rsync is tool for transferring data securely between hosts while maintaining data integrity and providing the ability to resume transfers if they are interrupted. Rsync requires the use of ssh keys for security. If you do not have ssh keys set up when transferring between hosts you will be prompted to enter your password before the file transfer begins.

1. Basic Rsync Syntax

  • rsync /path/to/folder/ user@host:/path/to/folder

1.1 More Efficient Rsync

In the examples below will modilfy the rsync options to make transferring files more efficient, for instance using the command: rsync -vhat --progress -e "ssh -c arcfour -o Compression=no -x" we can speed up files transfers by removing some of the overhead caused by the default ssh and using the compression built into rsync instead. Optional rsync and ssh flags are as follows:

  • rsync:
    • -v: increase verbosity
    • -h: output numbers in a human-readable format
    • -a: archive mode - rescursive, preserves owner, preserves permissions, preserves modification times, preserves group, copies symlinks as symlinks, preserves device files.
    • -t: preserve modification times
    • --progress: show progress during transfer
    • -e: specify the remote shell to use
  • ssh:
    • -c arcfour: use the weakest but fastest SSH encryption. Must specify "Ciphers arcfour" in sshd_config on destination.
    • -o Compression=no: turn off SSH compression.
    • -x: turn off X forwarding if it is on by default.
  • Example 1: local file system to remote host

    rsync -vhat --progress -e "ssh -c arcfour -o Compression=no -x" source user@host:/path/to/folder

  • Example 2: remote host to local file system

    rsync -vhat --progress -e "ssh -c arcfour -o Compression=no -x" user@host:/path/to/folder destination

Other Resources

Center for Advanced Research Computing

MSC01 1190
1601 Central Ave. NE
Albuquerque, NM 87106

p: 505.277.8249
f:  505.277.8235