Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 07-19-2010, 12:49 AM   #1
Registered: Jun 2010
Posts: 30

Rep: Reputation: 0
Generating Public and Private Keys using putty key gen

Hey guys,

Thanks for your help the last time...really appreciated. Another question though...i have a fedora 12 server set up and i have created 3 sudo users. I have created 3 putty keys (public and private) using putty key gen and based on my research i was told to put the public keys in /home/"user"/.ssh/authorized_keys . I did that but when i tried to log on using the key...the server is saying "server refused key" could anyone assist in this issue?

Thanks in advance,
Brian Hall
Old 07-19-2010, 12:53 AM   #2
Registered: Jun 2010
Posts: 361

Rep: Reputation: 59
putty has its own file format for keys which differs from openssh. but putty-keygen shows the openssh-style of the public key in a textbox when you load (or generate) a key. copy&paste just this to ~/.ssh/authorized_keys
Old 07-19-2010, 02:13 AM   #3
Registered: Jun 2010
Posts: 30

Original Poster
Rep: Reputation: 0
still not is that authorizes_keys is a file or folder. To access my linux server i use both putty and winscp does the server need something installed in order to work....does it need openssh to be installed?...if so how do you install it?
Old 07-19-2010, 02:19 AM   #4
Registered: Jun 2010
Posts: 361

Rep: Reputation: 59
If you get the message "server refused key", openssh IS installed. Otherwise you'd get "connection refused" or something like that.

authorized_keys is a file, containing one key per line. putty-keygen will show you the appropriate line in a textbox when you load your key.

winscp uses keys in putty file format, so ne problem here.
Old 09-16-2010, 11:47 PM   #5
Senior Member
Registered: Feb 2008
Location: Pune - India
Distribution: Fedora,RedHat,CentOS,Gentoo
Posts: 1,145
Blog Entries: 4

Rep: Reputation: 147Reputation: 147
Thumbs up

From the Start menu, run Start > All Programs > PuTTY > PuTTYgen

Click the Generate button. You will be prompted to move the mouse over the blank area to generate some randomness. Do so. Shortly thereafter, the program will generate the key and display the result

Enter a passphrase in the "Key passphrase" and "Confirm passphrase" boxes

Install the public key on the remote host to which you want to connect. Do this by pasting the public key from the Clipboard into the the authorized_keys file, which is located in the .ssh directory in your home directory on the remote host

Verify that public key authentication works. Basic public key authentication is enabled for a particular session in the Connection > SSH > Auth window. You must load the session profile before configuring the Auth window

Browse to select mykey.ppk in the "Private key file for authentication" text box. Be sure to go back to the Session window and click Save to update the profile. The session will use public key authentication

To invoke basic public key authentication for file transfers with pscp.exe, use the -i flag on the command line and specify mykey.ppk as the flag's argument.

During either login or file transfer, supplying the passphrase when prompted decrypts the private key on the fly for use in the authentication process.

At first glance, basic public key authentication offers no advantages since a passphrase is always required. However, single signon can be achieved by setting up the PuTTY authentication agent, Pageant (pronounced page-ant).

Starting Pageant (Start > All Programs > PuTTY > Pageant) puts an icon in the system tray. Right-click on the icon and choose "Add Key

When the "Select Private Key File" dialog appears, find mykey.ppk. You will be prompted for the passphrase so that Pageant can store the unencrypted private key in memory to use in authentication. Remove mykey.ppk from the "Private key file for authentication" text box in the Connections > SSH > Auth window for the session profile. All subsequent logins and file transfers will by authenticated by Pageant
For convenience, you can have Pageant start up and load the key automatically whenever you log into your Windows desktop. Do this by creating a shortcut in your Startup folder as follows.

Go to the Startup folder by right-clicking the Start button, select Open, double-click on the Programs folder, then double-click on the Startup folder. Inside the Startup folder, right-click and select New > Shortcut. In the "Type the location of the item" text box, enter the full path to the Pageant program followed by the full path to the key file.

For example,
"c:\program files\putty\pageant.exe" "c:\documents and settings\prayag\pka-putty\mykey.ppk"

Click Next. Enter "mypageant" (or a name of your choice) in the "Type a name for this shortcut" box, then click Finish.

The next time you log in to Windows, Pageant will start automatically, load the specified key, and prompt you for the passphrase.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Public and Private Keys??? ajeetraina Linux - Server 2 05-10-2008 02:15 PM
private key for putty melvinong Linux - Server 2 11-13-2007 05:33 AM
SSH public/private key authentication with GnuPG keys? thinksincode Linux - Security 1 02-25-2005 02:33 PM
public/private key authentication with PuTTY NetAX Linux - Security 5 10-27-2004 06:00 PM
RSA public key encryption/private key decription koningshoed Linux - Security 1 08-08-2002 07:25 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:55 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration