Monday 24 September 2012

Linux - Transfer Files with Netcat behind VPN or Firewall


By on Monday, September 24, 2012


So, Have you ever been in a situation where you are behind a VPN or a firewall?Yes?.  If you ever are in the situation of being stuck behind a firewall or VPN connection and want to transfer a file from the machine inside the VPN or firewalled back to your local desktop.Seems Difficult? Not at all! it can be easily achieved using the netcat {nc} command. Read below for Step by Step Instructions




So, What is Netcut and why is it needed? In the simplest term, netcat is a utility that reads and writes data across the network. The netcat utility, or just nc, works on the same principle as the cat utility, but over the network. This can be very useful in a number of situations, such as testing remote services, or for use in scripts, or just to copy files over the network. The syntax for netcat is pretty simple: netcat hostname port will connect you to a server on the port specified, and allow you to send input to whatever service answers on that port. So, that's teh basic about Netcat. Now here is how to send the file over Network



On the server we’re going to pipe the output of file through cat and set netcat to listen on port 3345


# cat file-i-want-to-send.ext | nc -3345



On the desktop,  open a nc session to port 3345 and redirect the output to a local file.


# nc server.ip.address 4009 > file-i-want-to-recieve.ext


And viola! Its Done! Pretty simple!One more thing, you can verify the file is intact by doing a md5sum on the server and compare it to the one locally


On Server

# md5sum file-i-want-to-send.ext
# e4ef527eac8f5afe26d8464a963694ad file-i-want-to-send.ext


On Client

# md5sum file-i-want-to-recieve.ext
# e4ef527eac8f5afe26d8464a963694ad file-i-want-to-recieve.ext

About Shaunak

A tech lover who loves writing and sharing with people.

1 comments:

  1. There square measure scores of totally different LINUX VPN server packages obtainable on the web these days. Initially look this would possibly really sound sort of a sensible factor. With lots of various software packages to choose from, one would possibly suppose that it makes putting in your own VPN abundant easier or higher. However, the reality is it really makes it a euphemism of lots harder and confusing. LINUX may be a extremely popular operating system for servers, and if you’re trying to line up a VPN of your own that runs one among the numerous variations of the operating system obtainable these days, then I powerfully suggest that you simply see link.

    Information About Linux VPN

    ReplyDelete