Transferring files with Netcat/nc

Individual files can also be transferred using netcat. To do this, the following instructions must be used on the transmitter and receiver:

On the receiver:

nc -l -p 8888 -w 5 > ziel < /dev/null

At the sender:

nc servername 8888 < quelle

Explanation: The recipient starts a server service based on the first parts, which reacts to requests on TCP port 8888. With the instruction > ziel the content of received data is written to a file name ziel.

The file transfer is started on the transmitter by entering the second instruction. Here a connection with the server servername via port 8888 is initiated and the file quelle is transferred.

The file is transmitted unencrypted and uncompressed. Using tools like gzip and openssl this could be implemented transparently.

Leave a Comment

+ 52 = 57