Mon 14 Aug 2006
For Linux administrators that use Windows for their desktop OS, Putty is an invaluble tool. This tutorial will help you save time administering your servers without having to login to provide a username and password each time.
Click to play tutorial:
- Download PuTTY
- Download PuTTYgen
- Open PuTTYgen
- Select SSH-2 RSA
- Click ‘Generate’
- Save the Private Key
- Click ‘Save private key’ (you do not have enter a password)
- Save the private key in location easy to remember.
- Copy public-key
- Select all text in the public key area.
- right-click and select copy
- Configure the server settings in Putty
- Open Putty
- Click Session (left column)
- Enter the server hostname or IP address
- Enter a name under ‘Saved Sessions’
- Click Connection > Data (left column)
- Enter ‘root’ for the auto-login username
- Click Connection > SSH (left column)
- Select ‘2′ as the Preferred SSH protocol version.
- Click Connection > SSH > Auth (left column)
- Browse to the private key from step 4.
- Click Session (left column)
- Click Save
- Open a session with the server
- Open PuTTY
- Select the session saved earlier.
- Click ‘Load’
- Click ‘Open’
- Login
- Add client public key.
- You should still have the public-key in the clip-board from step 5.
- Open the authorized_keys file on the linux server
- [root@server]#vi ~/.ssh/authorized_keys2
- Press the ‘i’ key to insert in vi.
- Go to the bottom of the file and right-click on the putty screen (This should insert the public key generated with PuTTYgen)
- Press the ‘esc’ key to get out of insert mode in vi.
- Press ‘:’ to enter command mode in vi
- Type ‘wq’ to write and quit vi
- Now, you should be finished. Let’s test.
- Open PuTTY
- Select the session saved earlier.
- Click ‘Load’
- Click ‘Open’
- If you were able to login without entering your username and password you are finished!!If not, please continue to troubleshoot.
Troubleshooting: If you do not have a /root/.ssh folder, we will have to create one and set the permissions:
[root@server]#mkdir ~/.ssh
[root@server]#chmod 700 ~/.ssh
If you do not have a authorized_keys2 file, we will need to create one and set the permissions:
[root@server]#vi ~/.ssh/authorized_keys2
[root@server]#chmod 644 ~/.ssh/authorized_keys2
If you get an error that the key was rejected, you need to make sure the permissions are set correctly on the .ssh directory and authorized_keys2 file.
[root@server]#chmod 700 ~/.ssh
[root@server]#chmod 644 ~/.ssh/authorized_keys2










July 2nd, 2007 at 3:39 am
Hello! Good Site! Thanks you! sehjyoazcgby
July 2nd, 2007 at 3:54 am
Simple one but very valuable one for linux administrators..
Thanks man
August 20th, 2007 at 2:30 am
very helpful, thanks
January 8th, 2008 at 12:34 pm
Hi,
Thanks for putting up such a helpful video.
what should I do if I get a prompt from putty saying “a new key has been created for a new host?”
January 8th, 2008 at 1:42 pm
If you get a prompt about a new key, just accept it. The happens the first time you connect to an ssh server.
April 2nd, 2008 at 3:08 pm
Could you do this with a Cisco switch? I’d love to be able to use this with KiwiCat Tools to securely automate config backup on my switches.
April 4th, 2008 at 11:05 pm
I do not think it is possible to use public-key encryption for login authentication on Cisco routers or switches.
However, I will love to be proven wrong. I would also like this feature.
Josh