How to Use Putty and SSH
Data travels across the Internet in a raw form which may be intercepted by anyone between the origination computer and the destination computer. Known as a "man in the middle attack" hackers and anyone else with malicious intentions can steal your data and use it for identity theft, corporate espionage, and even criminal impersonation. PuTTY is a teletype (tty) program that may be used with the encryption services of Secure Shell (SSH) to ensure that your data is encrypted as it travels between computers. To use PuTTY with SSH, you must configure PuTTY to communicate with the SSH server's SSH service.
Things You'll Need
- Computer with Internet access and PuTTY installed
- Website hosting account with SSH access
Start the PuTTY program on your computer and wait for the main dialog box to appear on your screen.
Enter the host name of the server on which you host your website or shell account, placing it in the "Host Name" box of the PuTTY dialog box on your screen. This information should have been given to you by the system administrator of the server on which your account is hosted. An example would be if your website address is http://www.myawesomesite.com. The actual host name of this address is "myawesomesite.com" without the rest of the address components. This is what would be entered into the "Host Name" block of the PuTTY dialog box.
Tell PuTTY what kind of data connection you desire for it to initiate when logging into the server. To do so, look at the section of the dialog box labeled "Connection Types" and note that a multitude of buttons exist in this section including: telnet, rlogin, SSH, and raw. Click on the SSH button to prepare PuTTY for an SSH login to your server.
Look at the "Port" block on the PuTTY dialog box and verify that the port number is set to 22. This is the default SSH port that all SSH servers listen on for incoming connections. This port number should never be changed unless the system administrator of your host server has informed you that the server listens on a different port. If a different port is used on your server, enter that port number into this port block now.
Begin the SSH connection process. Locate the button at the bottom of the PuTTY dialog box labeled "Open" and click on it. Connection progress information will now be displayed in the main text area of PuTTY.
Verify the host SSH key and add it to your PuTTY terminal cache for future log-ins. A caution message will appear in the main terminal screen of Putty if it is the first time you have logged into an SSH session with the server. The message is a cautionary measure telling you the server fingerprint identification number. It will ask you if you want to trust the server and to have its key added to your PuTTY terminal program's cache. If you are uncertain, call your system administrator by phone and ask him to read you the server fingerprint number to verify it. Whether you made a call, or simply choose to accept it, enter "Yes" at the prompt on the text screen to accept the key and to have it added to PuTTY. The verification step will now be complete.
Wait for the log-in prompt to appear. The first line of SSH servers when logging in will require your hosting account user name. Enter your user name on the first prompt line when asked for it, then press the "Enter" or "Return" key on your keyboard to send it. After sending your user name, the prompt will ask for your password. Enter the password for your hosting account and press the "Enter" or "Return" key to send it. If you entered both correctly, you will get a command prompt through which you may perform your system commands.
Log out of your SSH session when finished by typing either "logout" or "exit" (without the quotes) at the command prompt on the screen, then press "Enter" or "Return" on the keyboard to log out completely. Whether "logout" or "exit" is used depends on how the hosting server is set up. Try both if you are unsure. If the first one you try doesn't work, then the other will. If neither works for some reason, contact the administrator of your hosting account and ask what the logout command is for that server.
Tips & Warnings
- The "Close" button in PuTTY can be used to end a session, but this doesn't always send the "logout" or "exit" command to the server explicitly. This means that a session may continue until it times out while you thought PuTTY ended it. It is best to explicitly type "logout" or "exit" in the actual command screen to log out of an SSH session rather than relying on PuTTY's "Close" button.