My goal is to be able to ssh into localhost on my remote linux machine (Ubuntu 12.04 LTS x64).

I have a private key that on my local Windows that I use in putty to access that remote machine. On the remote machine, ~/.ssh/authorized_keys contains the corresponding public key.

In puttygen, I loaded this private key and used "Export OpenSSH key". Puttygen then warns me "Are you sure you want to save this key without a passphrase to protect it?". The content of that key is then stored in ~/.ssh/id_rsa in the remote machine.

However, when I try to execute ssh localhost on the remote machine, I am asked for a password. Just pressing enter yields

me@host:~/.ssh$ ssh localhost
Enter passphrase for key '/home/me/.ssh/id_rsa':
Permission denied (publickey,hostbased).

File / folder permissions are as such:

me@host:~/.ssh$ ls -lsa
total 20
4 drwx------  2 me sudo 4096 Aug  6 09:43 .
4 drwxr-xr-x 11 me sudo 4096 Aug  6 09:38 ..
4 -rw-------  1 me sudo  381 Feb  1  2014 authorized_keys
4 -rw-------  1 me sudo 1589 Aug  6 09:38 id_rsa
4 -rw-r--r--  1 me sudo 1106 Aug  6 08:44 known_hosts

What can I do to be able to password-less ssh into localhost?

  • That should work. Can you 1. Stop SSH daemon 2. Run /usr/sbin/sshd -d 3. Try to log on 4. Post the output? – mtak Aug 6 '14 at 8:03
  • I have no physical access to this machine (virtual server in a cloud). Won't stopping the ssh daemon block me out completely? – helm Aug 6 '14 at 8:06
  • Stopping SSH will not close the existing sessions. Just make sure you don't close the PuTTY window ;) To be sure you can run sshd on an alternative port with /usr/sbin/sshd -d -p 2222 and run the ssh client with ssh -p2222 localhost – mtak Aug 6 '14 at 8:07
  • Thanks @mtak, this is good to know. However, upon reading the log, I copied my private key again just to be save. I don't see anything I did differently, but it works now. Strange, but good enough for now. – helm Aug 6 '14 at 8:22

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.