4

I'm trying to setup password-less SSH login, and I can't seem to make it work. Here is what I have done so far:

  1. Used ssh-keygen -t rsa to generate a pair of keys
  2. Created ~/.ssh/authorized_keys on the server and dumped the public key in that file
  3. chmod 700 ~
  4. chmod 700 ~/.ssh
  5. chmod 600 ~/.ssh/authorized_keys

When I attempt to login with the private key I get the following output from ssh -vvv:

debug1: Next authentication method: publickey
debug1: Trying private key: /path/to/private-key
debug1: read PEM private key done: type RSA
debug3: sign_and_send_pubkey: RSA [KEY_FINGERPRINT_HERE]
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: password,publickey
debug2: we did not send a packet, disable method
debug3: authmethod_lookup password

I'm pretty sure the server is running FreeBSD, but it's not mine, and I don't have root access. Any idea on what's going wrong here or what I can try to get this working?

4
  • Check the permissions on the local private key file -- should be readable only to you.
    – ewhac
    Jan 7, 2014 at 21:40
  • Thanks for the suggestion. Unfortunately, I'm getting the same result after changing the permissions on the private key file.
    – Dominic P
    Jan 7, 2014 at 21:44
  • remove the authorized keys file. Transfer the key to the server with ssh-copy-id - ssh-copy-id -i key_name user@server (you will use your login in password here, not your key password) , then ssh into the server ssh -i ~/.ssh/key user@server If it works, disable your password. If that fails, post the command you use and make sure you are using the correct password.
    – Panther
    Jan 7, 2014 at 21:47
  • Ok, I deleted the .ssh folder, generated a fresh pair of keys, and used ssh-copy-id to transfer the public key to the server. It created a .ssh folder and an authorized_keys file, but I still can't log in with the private key. So frustrating. Which command did you want me to post?
    – Dominic P
    Jan 7, 2014 at 23:47

3 Answers 3

3

Well, the "solution" to this wound up being related to the host. The server is run by a company called HybridCluster. I'm still not exactly sure why, but in order to use public key authentication with their servers, the public key has to be added via their control panel interface and not manually to the ~/.ssh/authorized_keys file.

I think it has something to do with them dynamically switching hardware, so the host fingerprint changes which causes the key to be rejected, but I really can't say for sure.

Anyway, thanks to all who helped, and hopefully this will help some poor HybridCluster user in the future.

2

Why did you chmod your HOME folder on the server? There is no need to do that, and I think it might hamper your connection attempts. Please restore it to 755, and try again.

2
  • I think I read a tutorial online that suggested changing the home folder's permissions. I changed it to 755, and unfortunately, there was no effect. Any other ideas?
    – Dominic P
    Jan 8, 2014 at 21:46
  • Just for reference. This was the post I saw pointing to the home folder permissions as a possible issue: askubuntu.com/a/90465.
    – Dominic P
    Jan 9, 2014 at 0:04
0

I'm fairly sure that putting the public key in the authorized_keys file is the issue. Your assumption is that your hosting company has configured that as the AuthorizedKeyFile. If you had root access you would check your ssh server settings - often a sshd_config file (/etc/ssh/sshd_config on debian).

The default setting you have assumed is:

AuthorizedKeysFile     %h/.ssh/authorized_keys

However they may have something else. You can explore your home directoty and show hidden files to explore further.

All the best!

You must log in to answer this question.

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