(Large) files transfer with Netcat

From time to time I need to quickly transfer files from an host to another. Setting up an FTP server is painful, giving an SSH account can be dangerous .. so I’ll present here a quick and efficient solution using Netcat:

host1:$ nc -lvp 3333 | tar -xv
host2:$ tar -cv file [files…] | nc -v IP_host1 3333

where host1 is listening on port 3333 for files sent by host2.