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?

  • I'd create an ~/.ssh/config file and add an entry for your server. linux.die.net/man/5/ssh_config – ryekayo Nov 14 '16 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 Nov 14 '16 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. – Shadur Jun 16 at 21:30
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.

  • /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 Nov 21 '16 at 10:03
  • Yaiks How do i format my code in a comment – Broshi Nov 21 '16 at 10:05
  • I think the : are not needed – Spone May 7 '18 at 15:30
  • Yeah your right.. ill adjust my answer – ryekayo May 7 '18 at 15:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.