Using SSH (secure shell) protocol during file transfer can decrease the chances that your web server's security will be compromised. There are a variety of SSH clients available. Putty, an open source SSH client, offers a number of advantages. This article will explain how to use it.
One of the most important aspects of transferring files (uploading or downloading) to a web server is security. The basic method of transferring is FTP, which is not secure; it sends transmitted information in clear text form. This increases the risk of eavesdropping, and in the long run can increase the chances of having your web server access compromised.
However, the solution to this problem is to use SSH (another name: “secure shell”) protocol during file transfer. SSH effectively encrypts the communication channel between the client (your computer) and the SSH server. In this way, any hacker or eavesdropper has no means of identifying your passwords, login information, etc as your packets travel on the Internet. This drastically improves the security of your file transferring session.
This tutorial focuses on the use of the Putty SSH client, an open source SSH client for Windows-based operating systems (Windows 7, XP, etc). Other aspects discussed include how to establish SSH sessions and use it to browse web server files. Simple SSH commands will be discussed; there will also be a detailed discussion of transferring and moving files from the client computer to an SSH server.
If you are confused as to how to execute command line statements in Putty, then this article can help you. Let’s get started.
Enable SSH in your web hosting account
If you have a paid hosting account, find out from your web hosting support whether they have SSH included as one of their hosting features. If your web hosting package includes SSH, you need to enable it before you can use it to connect and transfer files. Consult your web hosting support for details.
If your web hosting package does not include SSH, you may try to switch to other hosting companies, but this is rare -- almost all Linux/Unix/Apache-based hosting includes SSH functionality in a paid hosting account. In my experience, depending on your web hosting company, adding SSH features or enabling them can cause your site to experience some down time, so you had better prepare for it. You can always consult your web hosting company for any additional SSH support.
To test if you have SSH enabled in the server:
Step 1: Go to Start -> All programs -> Accessories -> Command Prompt
Step 2: On the Windows DOS prompt, ping your website by executing your command (replace the domain with yours): ping php-developer.org
The command above will ping the website www.php-developer.org . Your objective is to learn the IP address of the website server, for example: 18.104.22.168
Step 3: Once you know your website server's IP address, execute the following command, and then press enter: ssh YOURFTPUSERNAME@YOURIPADDRESS
If the reply is something like this:
ssh: connect to host 22.214.171.124 port 22: connection refused
You have NOT yet enabled your SSH access. Replace the above examples with your own FTP username and website IP address. See sample screen shot below: