Thursday, May 31, 2012

Performing secure FTP-connection over SSH

Webmasters are often loaded scripts to the server via FTP. However, the default FTP connection does not secure and is not encrypted, so the password and the data is transmitted over the network in clear text. An attacker can simply intercept your data by the sniffer. If you have a server that supports the connection by SSH, then you can use it to encrypt your FTP-traffic, what is much safer. Many hosting companies offer this service. To encrypt traffic, you can use the PuTTY.

In PuTTY you must specify:

Host Name: your_ssh_server (or it's IP-address),

Port: 22

Next, go to the tab Connection > SSH > Tunnels

In the field Source port you must specify the port, which is free on a local machine, the number should be over 3000 (for example, 3111). Field Destination should be blank.

Check Dynamic.

Press Add button.

In the tab Connection > SSH you could enable compression, by checking Enable Compression. Compression will really work, and you download the 1.5 GB text file if it weighs only 50 MB.

Next, you can go back to the tab Session and save the session under the appropriate name, so that you can use the settings in the future.

After that, you should press Open and connect with SSH-server, entering login and password.

If the connection is successful, you will see the welcome console input screen. This means that PuTTY has connected to the server, and formed a tunnel. This tunnel is working on SOCKS, so to use it, the client program must have a corresponding ability to configure.

Unreal Commander and similar file managers (Total Commander) when configuring FTP connection allows you to specify a proxy, for which you specify 127.0.0.1:3111, that is, the tunnel, which was created by the PuTTY. Other FTP settings should be the same as without the proxy (server, login, password, etc.)

When you connect to FTP by the file manager in this mode, requests go first to PuTTY, then encrypted requests go to the server, which is connected to PuTTY, and then to the server, to which you connect via FTP. The last 2 servers can be "rolled into one", but it is not required.

This method is suitable not only for FTP, but in general for any traffic: you can encrypt pop3, IM messages, HTTP-traffic, etc.

0 comments:

Post a Comment