LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Generating Public and Private Keys using putty key gen (https://www.linuxquestions.org/questions/linux-newbie-8/generating-public-and-private-keys-using-putty-key-gen-820622/)

ghandizzle8 07-19-2010 12:49 AM

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

zirias 07-19-2010 12:53 AM

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

ghandizzle8 07-19-2010 02:13 AM

still not understand..it 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?

zirias 07-19-2010 02:19 AM

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.

prayag_pjs 09-16-2010 11:47 PM

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.


All times are GMT -5. The time now is 09:22 AM.