Thursday, June 5, 2014

Transferring files with netcat

On the destination server, set up a listen port by doing nc -l PORT > FILENAME, where PORT is the listen port to connect to, and  FILENAME is the filename you want to have on the destination server. This could be any number, but you probably want it to be >1000 due to Linux rules about ports.

Now on the source server, do

nc IP PORT < FILE, where IP is the ip of the destination server, PORT is the same as above, and FILE is name of the file to transfer.

An example, with IP =, PORT = 9001, FILE=backup.iso


nc -l 9001 > backup.iso


nc 9001 < backup.iso

No comments:

Post a Comment