0

I am running Ubuntu 16.04.1 LTS in a virtual machine on my Windows 7 laptop. I created a private and 2 public keys using PuTTY Key Generator. One of the public keys came from the "Save private key" button while the other came from Conversions > Export OpenSSH key. I used an FTP program to put the 2 public key files in the directory /home/myUserName on Ubuntu. Questions:

1) Which public key file do I want to use?

2) How do I determine where to put the public key file?

3) When using Ubuntu (not SSHing into it) what commands do I use to place/activate the public key file?

I would really appreciate any help. My Web searches are pulling up confusing information on how to create key files over an SSH connection. I've already got the file(s) and I just want to make them work.

7
  • 1
    Please review help.ubuntu.com/community/SSH/OpenSSH/Keys
    – Elder Geek
    Sep 8, 2016 at 20:00
  • I started there. It didn't help.
    – Tachyon80
    Sep 8, 2016 at 20:13
  • "Are you connecting from putty to ubuntu? If so, public keys which can authenticate are stored in ~/.ssh/authorized_keys, one per line." I'm seeing this on a number of sites. What is ~/.ssh/ ? I can't seem to navigate to it. Do I have to make it? If so, where do most people make it (in which directory)?
    – Tachyon80
    Sep 8, 2016 at 20:23
  • I would assume you only need 1 public key as nowhere in the documentation can I find a suggestion that you create 2
    – Elder Geek
    Sep 8, 2016 at 20:23
  • I know I only need one public key but PuTTYGen can make 2. Page 20 of Linux for Beginners says "Next, export the key as an OpenSSH key by clicking Conversions and then Export OpenSSH Key. This OpenSSH key can later be used on Unix or Linux systems."
    – Tachyon80
    Sep 8, 2016 at 20:27

1 Answer 1

0
  1. On your Ubuntu machine, you will need to have a file under /home/user/.ssh called authorized_keys
  2. This will need to have the permissions set to -rw-r--r--. You can set this via chmod 644 authorized keys via the command line on the virtual machine.
  3. Once the file is there, you will now need to edit the authorized_keys file and place the text of your openSSH public key inside. Ensure that there is no whitespace added to the text when copying it in. (You can edit this file via notepad, or notepad++)
  4. Save this file on the Ubuntu VM.
  5. Now that you have the authorized_keys file created, you should now be able to connect via PuTTy with your PRIVATE key.
  6. To do so, ensure that you have the .ppk file setup for your connection.
  7. You will navigate PuTTy into the Connections part of the tree, and then click on SSH
  8. Click on auth and at the bottom of the right side, you can see the section to browse for your .ppk.
  9. Once you have this selected, you should now be able to try connecting to the Ubuntu virtual machine via key auth.
2
  • Thanks for the help. I'm understanding this better now. What about using an SSH key to log in as root? Does one key allow me to log on as both userName and root? I want to work with apache and Web page files. Most of those files are set to root as their owner and group.
    – Tachyon80
    Sep 9, 2016 at 14:32
  • In reference to logging in with root. You can set this up the same way, but I'd suggest keeping root locked down from logging in over SSH. This can compromise the system more if someone can attempt to login as root (with the possibility of getting in). I'd suggest logging in as your username, and then su root when logged in to be root. Just a suggestion. Sep 13, 2016 at 14:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .