-
Notifications
You must be signed in to change notification settings - Fork 1
UsingPageant
In this section I'll shortly explain how to set up and use public key authentication for PuTTY. Of course, this also works for PuTTY Tunnel Manager. If you're interested in all the details, see the PuTTY documentation.
Public key authentication is an alternative means of identifying yourself to a login server, instead of typing a password. It is more secure and more flexible, but more difficult to set up.
The advantages are thus:
- No need to remember or use usernames and passwords for all your SSH sessions.
- More secure authentication
- Download Pageant (pageant.exe) and PuTTYgen (puttygen.exe) from here and place it in some directory (can be the same directory as where PuTTY Tunnel Manager resides).
- I assume you have PuTTY, if not, get it as well
- Start PuTTYgen (puttygen.exe).
- Click Generate and move the mouse over the blank area as indicated.
- Type in a password at Key passphrase (this is the only password you need to remember).
- Type it again at Confirm passphrase.
- Click Save public key and save it as "public_key.ppk" in your home directory.
- Click Save private key and save it as "private_key.ppk" in your home directory.
- Select the complete random text at the top (starting with "ssh-rsa") and copy it into a new text file.
- Save the text file as "public_key_for_authorized_keys.txt" (leave this file open for now).
Your public key can be given to anyone, or to every server. However, never, ever, give out your private key!
-
Start PuTTY (putty.exe).
-
Open a session to your desired server (that has tunnels, so you can use it with PuTTY Tunnel Manager) as usual and login.
-
Type in the following commands:
mkdir .ssh vi .ssh/authorized_keys
You just created a directory and opened up an editor.
-
Copy the contents of the "public_key_for_authorized_keys.txt" file (that you left open earlier) and paste it into the editor.
-
Save it by hitting the Esc-key and type ":wq" (without the quotes but with the colon) followed by Enter.
-
Type in the following command:
chmod -R 600 .ssh exit
This secured the just created file and closes the session.
Tip: You can do these steps for all servers you have in your session list.
- Start Pageant (pageant.exe).
- On the system tray, right click the Pageant icon, and click Add Key.
- Locate your private key (private_key.ppk) and open it.
- Type in your password for the key.
Tip: If you use PuTTY or PuTTY Tunnel Manager often, create a shortcut to Pageant followed by the location of your private key (ie. "C:\Program Files\PuTTY\pageant.exe" "%USERPROFILE%\private_key.ppk"). Place this shotcut in the Startup folder of your Start menu to have it start every time when Windows starts.
- Start PuTTY Tunnel Manager (ptman.exe).
- On the system tray, right click the icon and open the session that you copied your public key to.
You should no longer be asked for any password.