5 Ways to transfer files from a networked system

Hello! Today I bring you several ways to transfer files from a networked system to another system. That is, how to get files out of a system.

There are many ways to do it. Some of them with encryption and some of them plain. Logically the ones without encryption are faster but they should only be used in private networks and with non-critical data (to avoid data theft).

1. Rsync of a complete system

Rsync is a software that uses SSH to transfer files. As it works over SSH, it provides the encryption layer.

This utility has the ability to (as the name says), synchronize files. It detects changes to files and copies to the destination the files that have been modified.

Several options can be included: Respect permissions(-p), respect owner (-o), respect group (-g), recursive (-r), show progress (–progress).

The way to replicate a complete system to another system is to execute:

# rsync -avr --exclude={"/dev/*",
  "/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found","/boot/grub"} /* root@DESTINO:/ --progress

In this line it excludes all the temporary directories that will give problems, if you want to duplicate the machine to leave it operative in another location, it is necessary to exclude the network configuration files.

You can also execute the previous line to create a container or a backup if instead of copying it to “root@DESTINATION:/” you copy it to “root@DESTINATION:/DIRECTORY”.

If you only need to transfer files once and you do not have rsync at source and destination, you can use SFT which works in a similar way, except that it does not synchronize changes, it transfers all files.

2. DD + SSH

As mentioned before, the most versatile way to encrypt transfers is with the layer offered by SSH.

With the form of transfer that we will see next, we make a bit-by-bit copy of a file and send it via SSH. This option is very good for sending files to another host, for example when migrating a hard disk from a virtual machine.

The way to use it is:

dd if=ORIGEN bs=128k |pv |ssh root@DESTINO "dd of=DESTINO_PATH bs=16k"

You can also add gzip to the transfer to shorten the transfer time:

dd if=ORIGEN bs=128k |pv|gzip |ssh root@DESTINO "gunzip|dd of=DESTINO_PATH bs=16k"

The “pv” command reports the data flow that is transferred between pipes, so we would know the process. In the new versions of “dd” it already includes an option to show the process: “status=progress”.

This is what it would look like with “pv”


And this is what it looks like with “status=progress”.

dd status=progress


This software is able to mount a remote route via network using SSH, as in the previous ones, SSH provides the encryption layer. It does it in a similar way to NFS.

The way to do it is as follows:


Once mounted, files and directories can be copied to/from the mount point.

uso de sshfs
If you want to make a permanent mount of that mount point, one of the options (and the most indicated), is to include it in the fstab. To do this, just add a line:

root@HOST:/PATH_DESTINO  PUNTO-DE-MONTAJE  fuse.sshfs rw,nonempty

This is what it would look like:


4. SimpleHTTPServer

When we need speed, and we are in the same network or the machine from which we want to get the files has a public IP, the fastest option is this one. What it does is to mount a basic http server in the port that we specify, in the current path (execute “pwd” to see if we are in the required directory).

The way to execute it would be:


For example:


Afterwards, the IP could be accessed with a browser:

simplehttpserver visto con chrome

As you can see, through the browser you see the same as with “ls -al”:

ls -al

5. Netcat

The most traditional way to transfer files in plain text is netcat:

On the one hand you have to run it on the machine where you want to drop the file:


And on the original machine


In this case we do not see that there is no transfer report, this can be solved with PV:

On the target machine We run:


As you can see, this way only one file is transferred, so if you want to transfer a directory, the best thing to do is to create a tar file and transfer it.

That’s all for now. I hope you liked it, if so, please share the article in your social networks.

See you soon!

We recommend the following books:


Leave a Reply