PuTTY - A Windows telnet/rlogin/SSH client available free from http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html or just Google for putty and click the PuTTY Download Page. Since PuTTY is free, there is no reason not to have the most recent version. This tutorial is based on Version 0.58 and at the time of this writing (4/2005) Version 0.58 is the most recent version.
While at the PuTTY download site, also get puttygen.exe. The best thing to get is the complete zip package which includes the help files.
PuTTY can be used to SSH to a Linux server. To set this up follow the instructions below exactly. Don't skip anything and don't add anything. You can always play with it later once it's working. These instructions will work. The only possible exception is that your Linux distro puts things in different places. Change those steps accordingly. It's also possible that your Linux server uses SSH instead of OpenSSH. (AIT servers, for example. Call them)
First make sure the Linux ssh daemon (sshd) is running. on the Linux box:
$ /etc/init.d/ssh status
or for some non-Debian distros:
service sshd status
and if it isn't running, start it (as root)
# /etc/init.d/sshd start
or
# service sshd start
and try running ssh locally (as a regular user)
$ ssh localhost
You should be asked for a user name and password and then you will be in an SSH session. Type Ctrl-D or type exit to end the SSH session and return to your previous shell.
If this all meets with success, continue -- else seek help elsewhere and come back here when it works. This is one of the "way points" on your journey to the finish. Going past it without having success is to invite frustration.
Now go back to the Windows box and copy the putty.exe and puttygen.exe files that you just downloaded to someplace like
c:\program files\putty\
I would suggest extracting the entire zip package to that directory.
Create a shortcut to putty.exe and run it.
The PuTTY Configuration screen appears.
Enter the Host Name or IP address of the linux server and select the SSH radio button.
[Sidebar] There are probably lots of people now who have never seen a real radio button but years ago radio receiver station presets were selected by buttons that protruded from the front of a radio bezel. They were arranged mechanically so that only one at a time could be pushed in. Pushing in a different button would release the one that was already pushed in. That's why the widget is called a "radio button" because, unlike a checkbox, only one can be selected. Cheap radios would allow pushing in two buttons simultaneously but more expensive ones had a mechanically superior lockout design and would not allow more than one to be depressed.[End sidebar]
Type a human recognizable name in the Saved Sessions box
Click on the Connection Category and fill in the Auto-login username if you want. This doesn't have to be done and if it isn't filled in, the server will ask for a username.
Click on the SSH Category and select 2 only for the Preferred SSH protocol version
Leave all other options at their default settings unless you know what you are doing and have good reason to change them. You can always play with the options later. If you change any now, you're on your own from here on.
Click on the Session category and click Save to save the session information.
Click Open and a SSH session window will open and you will presented with the following:
The server's host key is not cached in the registry. You have no guarantee that the server is the computer you think it is.
The server's rsa2 key fingerprint is: ssh-rsa 1024 7b:e5:6f:a7:f4:f9:81:62:5c:e3:1f:bf:8b:57:6c:5a If you trust this host, hit Yes to add the key to PuTTY's cache and carry on connecting. If you want to carry on connecting just once, without adding the key to the cache, hit No. If you do not trust this host, hit Cancel to abandon the connection.
Select yes, and you will be asked for a username (unless you already provided it) and a password. You now have an active SSH session with the Linux server.
Log out with Ctrl-D or by typing exit or logout and the SSH session window should close. Restart PuTTY and double click on your Session Name and the login session should again proceed.
If this all meets with success, continue -- else seek help elsewhere and come back here when it works.
It is possible to use a SSH dsa or rsa key pair to avoid having to type a user name and password each time when logging into your linux box.
While this discussion is about using PuTTY on windows to SSH to a Linux box, this part also applies to using SSH with dsa key pairs to SSH from one Linux box to another.
In a Linux shell create a .ssh directory and chmod 700
$ mkdir ~/.ssh
$ chmod 700 ~/.ssh
Now type
$ ssh-keygen -t dsa -N ''
Note: the marks at the end are two single quotes (null)
A message will appear
Generating public/private dsa key pair.
It may help to move the mouse and type a few keys during the generating process to create entropy.
Press enter when asked to enter file in which to save the key (~/.ssh/id_dsa)
Change to the ~/.ssh directory and copy or append the public key file to authorized_keys
$ cd
$ cd .ssh
$ cat id_dsa.pub >> authorized_keys
make the private key read-only and only by owner
$ chmod 400 id_dsa
make the public keys read-only by all
$ chmod 444 id_dsa.pub
$ chmod 444 authorized_keys
Now try running ssh locally
$ ssh localhost
You should be taken immediately to an SSH session without being asked for a username or password.
Type Ctrl-D or type exit or logout to end the SSH session and return to your previous shell.
If this all meets with success, continue -- else seek help elsewhere and come back here when it works.
Copy authorized_keys to every Linux box you want to SSH to and copy id_dsa to every Linux box you want to SSH from.
You can put both keys on all Linux boxes for maximum utility. i.e. with two servers, you can SSH back and forth all day long. From box 1, SSH to box 2. From the box 2 SSH session, SSH back to box 1. From that session SSH back to box 2.. etc :)
Be aware that id_dsa is your private key. Be careful about leaving it on a box you do not have physical control over because this is all about avoiding having to enter passwords.
You can also SCP from one Linux box to another without having to use usernames and passwords. If the user names are different between boxes, an additional step is required. PuTTY has a scp utility (PSCP.EXE) that you can use from a DOS box from Windows. The syntax is the same as the Linux scp utility.
To make it easy to use one user account to SSH to another user account on a different server create a text file in the .ssh directory and name it config. Make the following entries for each server you will SSH or SCP to.
Host <alias name for the remote server>
User <username>
HostName <destination ip address or host name>
Port <port number if not 22>
for example, you want to SSH to a server available on the internet as myremotebox.com using port 2200. Your user name on the remote box is bar but your username on the local box is foo
Host changling
User bar
HostName myremotebox.com
Port 2200
Now, as foo you can SSH to the other server bar account.
$ ssh changling
and you will be logged in as bar.
You can SCP to that box also
$ scp /home/foo/stuff/myfile changling:stuff/
and the file will be transferred to /home/bar/stuff/myfile on the remote box.
If this all meets with success, continue -- else seek help elsewhere and come back here when it works.
Now back to PuTTY. To make the dsa keys work with PuTTY the private key must be converted to a .ppk (Putty Private Key) format using puttygen.exe. Copy your id_dsa private key file to someplace accessible to windows
(like c:\program files\putty)
and then start puttygen.exe.
select the SSH2 DSA radio button under "Type of key to generate" and click the load button.
open the "Files of type" dropdown and select "All files (*.*)"
click on the id_dsa file and click Open (or double click the id_dsa file)
A dialogue box will open. Read it carefully. It should say "Successfully imported foreign key (OpenSSH SSH2 private key)
Click the OK button
For the purpose of using PuTTY to SSH without having to enter a password, don't enter anything in the passphrase boxes.
[Sidebar] A passphrase is the same as a password but space characters are acceptable. It doesn't have to be a complete "phrase".[End sidebar]
Click the "Save private key" button, answer Yes to the "Are you sure" warning and save it with any name you want.
Suggestion: if the username associated with this key is foo save it as c:\program files\putty\foo.ppk
Close the puttygen file and start PuTTY.
Select your Session in the list of Saved Sessions and click the Load button
Select the "Auth" category and click the Browse button to select the ppk key you just imported (foo.ppk if you took my suggestion).
If you didn't previously enter a username, select the Connection Category and put the username for the remote account in the Auto-login username box.
Click the Session Category and click Save.
Click Open and soon you will be in the SSH session on the remote server.
That's it. You're done. If this doesn't work, you skipped a step or added one. These instructions must be followed exactly.
Go back and recheck all the steps.
Things that I screw up include:
If you have a program you want to run when you log in, place it in the "Remote command" box in PuTTY configuration SSH Category. Enter it just as you would type it in the shell.
Storing configuration in a file
PuTTY does not currently support storing its configuration in a file instead of the Registry. However, you can work around this with a couple of batch files.
You will need a file called (say) PUTTY.BAT which imports the contents of a file into the Registry, then runs PuTTY, exports the contents of the Registry back into the file, and deletes the Registry entries.
This can all be done using the Regedit command line options, so it's all automatic. Here is what you need in PUTTY.BAT:
@ECHO OFF
regedit /s putty.reg
regedit /s puttyrnd.reg
start /w putty.exe
regedit /ea new.reg HKEY_CURRENT_USER\Software\SimonTatham\PuTTY
copy new.reg putty.reg
del new.reg
regedit /s puttydel.reg
This batch file needs two auxiliary files: PUTTYRND.REG which sets up an initial safe location for the PUTTY.RND random seed file, and PUTTYDEL.REG which destroys everything in the Registry once it's been successfully saved back to the file.
Here is PUTTYDEL.REG:
REGEDIT4
[-HKEY_CURRENT_USER\Software\SimonTatham\PuTTY]
Here is an example PUTTYRND.REG file:
REGEDIT4
[-HKEY_CURRENT_USER\Software\SimonTatham\PuTTY]
Here is an example PUTTYRND.REG file:
REGEDIT4
[HKEY_CURRENT_USER\Software\SimonTatham\PuTTY]
"RandSeedFile"="a:\\putty.rnd"
You should replace a:\putty.rnd with the location where you want to store your random number data. If the aim is to carry around PuTTY and its settings on one floppy, you probably want to store it on the floppy.
To run a PuTTY session saved under the name "mysession", create a Windows shortcut that invokes PuTTY with a command line like \path\name\to\putty.exe -load mysession
To start an SSH session straight from the command line
Use the command line putty -ssh host.name. Alternatively, create a saved session that specifies the SSH protocol, and start the saved session as shown above.
![]() |
This site best viewed with a browser |
| Warning: This is a Debian centric site and MAY contain peanuts. | |
| Many thanks to Debra Lynn and Ian Murdock for making Debian possible | |
| First created Apr 22, 2008 ~ Last revised September 10, 2010 |