2

Although I placed my public key on the remote machine yet I am still getting the ssh password prompt, here's my ssh -vv output (just the last rows) that might help:

debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/lior/.ssh/id_rsa  <-- THAT's MY PRIVATE KEY!
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Trying private key: /Users/lior/.ssh/id_dsa
debug1: Trying private key: /Users/lior/.ssh/id_ecdsa
debug1: Trying private key: /Users/lior/.ssh/id_ed25519
debug2: we did not send a packet, disable method
debug1: Next authentication method: password

Important: I am able to ssh to other machines without password after doing the same procedure, so I assume the problem is on the specific remote machine (which runs on CentOS 6).

Any ideas?

3
  • I'd create an ~/.ssh/config file and add an entry for your server. linux.die.net/man/5/ssh_config
    – ryekayo
    Commented Nov 14, 2016 at 13:44
  • 2
    The key is rejected by the server. Make sure the server is properly configured to accept your key (permissions, SELinux labels).
    – Jakuje
    Commented Nov 14, 2016 at 14:27
  • Set verbose logging on on the server if you have access. If you don't, ask the sysadmin to check what it has to say. Commented Jun 16, 2019 at 21:30

2 Answers 2

1

In the remote user's home dir:

  • who is the owner of the homedir ?
  • who is the owner of homedir/.ssh ?
  • who is the owner of homedir/.ssh/authorized_keys

Which is the access rights on ~, ~/.ssh and ~/.ssh/authorized_keys

to permissive read and or write rights on ~/.ssh/authorized_keys will make sshd distrust that file !

1
  • I agree with you, most likely this is a remote config issue, like wrong permissions on home dir, .ssh or authorized_keys file. Commented Aug 16, 2020 at 15:49
0

Not sure if this will solve this problem 100% but try this out. Create a file in the directory ~/.ssh/config. When you vim into the config file, you can try the following:

Host <host_name_of_server>
HostName <ip_address_of_server>
User <user_created_for_server>
Port 22
PasswordAuthentication No
IdentityFile <path_to_key>

So once this has been added, you can now do the following:

ssh <host_name_of_server>

When you SSH into the Host that you assigned your server, this will force it not to prompt for a password. Let me know how this pans out.

4
  • /Users/lior/.ssh/config: line 1: Bad configuration option: host: /Users/lior/.ssh/config: line 2: Bad configuration option: hostname: /Users/lior/.ssh/config: line 3: Bad configuration option: user: /Users/lior/.ssh/config: line 4: Bad configuration option: port: /Users/lior/.ssh/config: line 5: Bad configuration option: passwordauthentication: /Users/lior/.ssh/config: line 6: Bad configuration option: identityfile:
    – Broshi
    Commented Nov 21, 2016 at 10:03
  • Yaiks How do i format my code in a comment
    – Broshi
    Commented Nov 21, 2016 at 10:05
  • I think the : are not needed
    – Spone
    Commented May 7, 2018 at 15:30
  • Yeah your right.. ill adjust my answer
    – ryekayo
    Commented May 7, 2018 at 15:31

You must log in to answer this question.

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