Last updated on May 28, 2017
In this brief post, I am writing down the three key inputs to setting up a PuTTy connection.
Why do I need PuTTY?
PuTTY allows us to log on to your remote server and move files around the space that we have rented there.
Retrieve files from the internet
For example, once we have used PuTTY to log in into our rented space on our remote server, we can use the wget command to fetch a file from the internet.
Manipulate files and directories in our space on the server
We can also use PuTTY to unzip that file. As the file in the example above is a tar file, the command is a little more complicated than unzip filename
tar –xvzf drupal-7.15.tar.gz
tar -xvf whatever.tar
While we are logged in to our rented server space using PuTTY, we can also make a directory
And rename a directory
mv oldname newname
And remove an empty directory or a file
Move files between Windows and our server space
In theory we can move files between a Windows machine and our server. This did not work on my server and their support helpfully referred me to the help page I was using and querying. Maybe these commands work elsewhere.
From Windows to your server
scp username@linuxMachineAddress/linux directory path C:Documents/filename.extension
From our server to windows
pscp firstname.lastname@example.org:/home/ftpusername/helloWorld.txt C:Document/shelloWorld.txt
PuTTY is a tool rather than a Program. That is, it doesn’t install in the Programs on Windows. Download it to wherever you store your tools. I have a directory c:/tools (the lowercase t reminds me this is a user directory and not a default folde that came with the computer and the standard install of Windows).
Download PuTTY.exe here.
Set up PuTTY
To use PuTTY on a Windows machine, you simply double click on the icon in c:/tools and select Run. A menu opens and you have a baffling array of choices.
Fortunately, you are able to store your choices. The most convenient thing to do is to store the setup of PuTTY for each connection you are likely to make. That way, when you come back, you only have to pick your settings from a list.
For example, if you website is on server99 at dreamhost.com, you want to set up PuTTy to connect to server99.dreamhost.com. Let’s also imagine that you have two users on server99. You have one set of settings for user1 at server99 and another set of settings for server 2. You save both sets of settings separately as user1settings and user2settings. In future, you simply pick the correct settings, PuTTY will connect to the server for you and you are then asked for your Password.
The key settings are
- Session: Enter your host name (e.g. server99.dreamhost.com) and select SSH
- Data: Input your ftpusername in Auto login username
- SSH: Select “2 only”
- Session: Enter a descriptive name into Saved Sessions and Save
Notes: On Dreamhost, you have an account (that you pay for). Withing that account, you will have space on one of their servers; hence a server name. On that server, you can create any number of users with names you provide. Within that user, you can host more than one website though Dreamhost prefers to set up a separate user for each website so that the damage is limited if that user gets hacked.
When you need to connect to your server:
- Go to c:/tools (or wherever you stored PuTTY)
- Doubleclick and Run
- Select your settings and open
- When you are asked for your password, type in your FTP Password (that you set up on your server when you set up your account or set up a new user)
- PuTTY gives no indication that you are typing. Do not worry. Type the password accurately and press Enter.
- There is a short delay and then you are in to your server.
- To exit PuTTY, type exit<enter>.
Moving around your space
Important commands for moving around your space and staying oriented are
List files: ls
Change directory downwards: cd directoryname
Go to root: cd
Go up a directory cd ..
Now you are equipped to log on to your server in a few clicks and a password, to upload and download files, to unzip files, to rename directories, to delete directories.
Notes: A question to myself. Do you not need shell access to use PuTTY. When you are logged in to Dreamhost, you can request shell access for any user (remember you set up users within your account and you will have to request this for each one.).