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 > dest < /dev/null
At the sender:
nc servername 8888 < source
Explanation: The recipient starts a server service based on the first parts,
which reacts to requests on TCP port 8888. With the instruction > dest
the
content of received data is written to a file name dest
.
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 source
is transferred.
The file is transmitted unencrypted and uncompressed. Using tools like gzip
and openssl
this could be implemented transparently.