Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 259
  • Last Modified:

Coming from Linux openssh keygen, where do I put the keys in puTTY?

I have done this before, but so long ago, and cannot recall the gory details. The following is what I remember. However,  the key is refused by puTTY. Tell me where I am going wrong.

On Ubuntu linux under root, I am creating the keypair using: <ssh-keygen -t rsa>.  While in ssh-keygen, I chose ~/.ssh as the location. Then, I made the permission for the .id_rsa private key as: <chmod 700 id_rsa>.  I see the two keys in my .ssh directory.

Still in Ubuntu, I created an authorized_keys file in .ssh with: <touch authorized_keys>. Then I copied the .pub file into authorized_keys with: <cat id_rsa.pub >> authorized_keys.

I do not know what the permissions should be for the key files and the authorized_key file. I am not sure where the authorized_keys file goes.

I am certain that the private key id_rsa remains in the .ssh folder under the user (~/.ssh/id_rsa).

Finally, I am assuming that I should ftp the .pub key to my Windows 7 machine, somehow puTTY will use that file to put the key into a local Windows file named: c:\putty\ privatekeys.pkk.

Someone please tell me where I am going wrong. Thanks in advance.
0
RayRider
Asked:
RayRider
  • 3
  • 3
1 Solution
 
mcsweenSr. Network AdministratorCommented:
I could post the step by step instructions here but this link gives a detailed tutorial how to set this up.  Like the tutorial, I always generate my keys using puTTYgen from the Windows side then paste my authorized_keys into a text file via ssh terminal.

You will create the keys, copy the public key to ~/.ssh/authorized_keys on the SSH server with 700 permissions, put the private key on the client computer (win 7) and enter it in putty under Connection\SSH\Auth 'Private Key File for Authentiacation'

http://www.ualberta.ca/CNS/RESEARCH/LinuxClusters/pka-putty.html
0
 
RayRiderAuthor Commented:
Additional comment: In Windows puTTY, I can find NO procedure to use the remote Linux's public key. I see a puTTY key generator that apparently creates the key pair and places the private key into the the file: c:\putty\privatekeys.pkk.

No provisions are made for Windows puTTY to use the remote "public key". At least, that I can determine. I thought the idea was to pass around the public key to the remote host. Apparently, I cannot pass the public key into puTTY, but must go the other way with the Windows puTTY public key being generated by puTTY and transferred to the Linux box. And, I am guessing the "authorized_keys" file in the ~/.ssh directory is where that puTTY public key should go.
0
 
RayRiderAuthor Commented:
Mcsween:

You were commenting and I was posting additional comment at the same time. Thanks for your link and advice. It appears I had just a few minutes ago figured out what you just told me. Let me give that a try and I will comment back. Thanks
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
mcsweenSr. Network AdministratorCommented:
Just in case, to comment on your update.

The public key goes on the SSH server, the private key goes in putty (see screenshot)
Enter your username to connect with (see other screenshot)
Once you've entered the settings under Auth and Data go back to the Session section and enter the hostname/IP Address, give the session a name and click Save.  Next time you can just double click on it in the list.

Authentication Steps:
puTTY will connect to the ssh server
SSHD asks puTTY for a username
If you entered a username on the data section puTTY sends the username, otherwise user enters it
puTTY will then attempt to authenticate with pre-entered private key.  If you have a password on this key (you should) then you will be prompted for it.
SSHD compares the private key to it's public key for that user (~./ssh/authorized_keys) and grants or denys access.
If the keys don't match puTTY then prompts your for your password to the SSH server
If they match then bash or whatever shell you are using launches
Capture.PNG
capture1.png
0
 
RayRiderAuthor Commented:
mcsween:

I got it to work finally. I would not follow the instructions in puTTY!!!  Instead of copying the public key at the top window into Windows clipboard as the job aid told me to do, I was clicking on the "save public key" button, and sending that file to the Ubuntu server to be inserted into the authorized_keys file. I have not checked to see what is different. But, once I pasted the screen to notepad and saved it, then ftp'ed the file to the Ubuntu server, the keys are now recognized.

Next, I wish to follow your last procedure to see if that works as well. That is more like the procedure I remembered where the key pairs were generated on Unbuntu and then copied to puTTY on Windows. I just had the keys backward, thinking the private key stayed with the Ubuntu box and the public key went to the Windows machine.

I am closing out and giving you the points. Thanks again!
0
 
mcsweenSr. Network AdministratorCommented:
An easy way to remember is the server shares it's key with anyone trying to log on as you which would make it public.  The key you have is used to authenticate is private like your password.

Glad you got it working!
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now