Skip to content

Remote file exchange with rsync

In short

If you want to sync a remote directory structure or file from or to your remote edge devices this can be easily achieved with rsync. This works on Linux, Windows and Mac utilizing the secure built-in qbee VPN through the qbee-connect tool.

First of all you need to establish an ssh connection from your local computer with qbee-connect. Start the application and connect your relevant device(s). Then you will be displayed the standard ssh command similar to:

ssh -p 12345 username@localhost

Through rsync you can now transfer files and directories from and to the device.

Some common rsync command options

  • -v : verbose
  • -r : copies data recursively (without preserving timestamps and permission while transferring data)
  • -a : archive mode, archive mode allows copying files recursively and it also preserves symbolic links, file permissions, user & group ownerships as well as timestamps
  • -z : compress file data
  • -h : human-readable, output numbers in a human-readable format
  • -e : which protocal name to use (e.g. ssh)

We define the following:

  • qbee mapped port : $PORTNUMBER, the mapped port from qbee-connect (here: 12345)
  • user on remote device : $USER (here: username)
  • path of the source directory in the remote device : $REMOTE_SOURCE_DIRECTORY
  • path of the local destination directory : $LOCAL_DESTINATION_DIRECTORY

Linux version

Make sure you have rsync installed, otherwise install it via your package manager (e.g. in Ubuntu use sudo apt-get install rsync). Got to your terminal and use

rsync -avz -e "ssh -p $PORTNUMBER" $USER@localhost:$REMOTE_SOURCE_DIRECTORY $LOCAL_DESTINATION_DIRECTORY

Now you should be able to see all copied files in your local $LOCAL_DESTINATION_DIRECTORY. All directories, files and subdirectories are transfered.

Mac version

All versions of macOS have rsync build into it as a standard tool. Please see under Linux for the syntax to call it from the terminal window.

This is how a typical rsync command would look:

rsync -avz -e "ssh -p 53467" pi@localhost:/home/pi /Users/IoT/device/RPI1

There are UI based tools available as well (one example is Acrosync, please see under Windows)

Windows version

Windows does not have a built-in version of rsync available. You can either find an open source package, use Cygwin, use WSL (Windows subsystem for Linux) or you can use a UI based commercial tool like Acrosync. They also have a 15 day trial license. When using standard rsync through cygwin the command is the same as for Linux. We are showing how to solve this with Acrosync here:

Install the Acrosync rsync client from here. Then run qbee-connect and connect your remote edge device. This will give you the mapped port number. Then start Acrosync and fill in all boxes as follows:

Acrosync does not work with localhost, so please use 127.0.0.1 as server URL

remote-file-transfer-rsync-windows

rsync or Acrosync work in both directions such that files / folders can also be uploaded

It is just as well possible to reverse the nature of the file transfer and upload files or folders to the remote edge device.