2
  1. created public/private keys using puttygen on my computer.
  2. put the public key in the .ssh/authorized_keys folder on the server
  3. setup pageant.exe to use the pk on my computer.
  4. when I run pageant, and connecting using putty it still asks me for my password.

what am I missing?

I did do a: chmod 700 on .ssh folder chmod 600 on authorized_keys file

thanks!

6 Answers 6

6

Check your /var/log/secure or /var/log/auth on the Linux server for information why the key is not accepted.

Also, is the .ssh directory in the homedir of (and owned by) the user you are using to connect?

If you want to connect with the root user, it might be disabled in /etc/ssh/sshd_config.

1
  • OMG Thank you so much. I had two servers with identical configs. Pubkey worked on one and not the other. Was driving me insane. /var/log/auth said that permissions on my home folder were the culprit. Never would have know about that log or thought to check home folder perms. I only checked the ~/.ssh perms and such. You saved me.
    – Apreche
    Jun 7, 2010 at 15:16
3

Note that public key authentication must be enabled in the SSH server config (usually /etc/ssh/sshd_config). Check for the line:

 RSAAuthentication yes

then restart the SSH server.

If that does not help, try debugging the problem, by running the server in debug mode (if you can). Here's a tutorial:

http://blog.codefront.net/2007/02/28/debugging-ssh-public-key-authentication-problems/

0
3

Make sure the permissions are correct on the keys and authorized keys files on the server.

chmod 700 ~/.ssh
chmod 600 ~/.ssh/*
1
  • This is the issue I've most frequently been bitten by after learning that Putty and OpenSSH use different formats for their key files.
    – Olaf
    Mar 12, 2010 at 7:33
2

Simple thing that burned me ... make sure your key is all on one (long) line in authorized_keys .

2

Looking at the reverse of your situation, I seem to recall that keys generated via ssh-keygen on Linux are not compatible with putty. One needs to first convert the keys using puttygen.exe (I think you can do this via the putty GUI).

So maybe you could try:

  1. Use ssh-keygen to generate some keys on the server - do not save them to the server's .ssh directory.
  2. cat id_dsa.pub >> ~/.ssh/authorized_keys
  3. Copy the id_dsa.pub and id_dsa to your computer.
  4. Use putty to convert them to the appropriate format.
  5. Set those keys as the public and private ones for your computer.
0

I seem to recall having problems when the users home directory was group/world readable. This blocked the key from working.

You must log in to answer this question.

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