Question

Unable to login on droplet using ssh (terminal from mac)

Unable to login on droplet using ssh (terminal from mac). I have added public key in .ssh/authorized_keys file and trying to connect. While connecting through ssh “ssh root@xxx.xx.xx.xx” Its asking for root password. Root password is already disabled. From windows putty we are able to login with private key without using any password. Do help me out.

Regards, Kapil

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hello there,

If you have more than one pair of ssh keys you can try to specify the exact ssh-key that you want to use for the connection. The exact command will be:

ssh -i .ssh/id_rsa2 root@DropletIP

Where id_rsa2 can be just id_rsa or id_rsa3 depending on how many ssh keys do you have and if you’ve followed the name convention as well.

Hope that this helps! Regards, Alex

OpenSSH_7.9p1, LibreSSL 2.7.3 debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 48: Applying options for * debug1: Connecting to 139.59.49.53 [139.59.49.53] port 22. debug1: Connection established. debug1: identity file zenkins type 0 debug1: identity file zenkins-cert type -1 debug1: Local version string SSH-2.0-OpenSSH_7.9 debug1: Remote protocol version 2.0, remote software version OpenSSH_7.6p1 Ubuntu-4ubuntu0.3 debug1: match: OpenSSH_7.6p1 Ubuntu-4ubuntu0.3 pat OpenSSH_7.0*,OpenSSH_7.1*,OpenSSH_7.2*,OpenSSH_7.3*,OpenSSH_7.4*,OpenSSH_7.5*,OpenSSH_7.6*,OpenSSH_7.7* compat 0x04000002 debug1: Authenticating to 139.59.49.53:22 as ‘root’ debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: algorithm: curve25519-sha256 debug1: kex: host key algorithm: ecdsa-sha2-nistp256 debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none debug1: expecting SSH2_MSG_KEX_ECDH_REPLY debug1: Server host key: ecdsa-sha2-nistp256 SHA256:uaKEDmDjWLaGk4Ws+d7v5PbUGnl6gGlz29++LrIPV5s debug1: Host ‘139.59.49.53’ is known and matches the ECDSA host key. debug1: Found key in /Users/Atique/.ssh/known_hosts:17 debug1: rekey after 134217728 blocks debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: rekey after 134217728 blocks debug1: Will attempt key: zenkins RSA SHA256:HPZUOgZLyxAzCG1mtY7689Bs+cD6CEasu913m2TLUzo explicit debug1: SSH2_MSG_EXT_INFO received debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521> debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey debug1: Next authentication method: publickey debug1: Offering public key: zenkins RSA SHA256:HPZUOgZLyxAzCG1mtY7689Bs+cD6CEasu913m2TLUzo explicit debug1: Authentications that can continue: publickey debug1: No more authentication methods to try. root@139.59.49.53: Permission denied (publickey). Atique-Ahmeds-MacBook-Pro:ec2 shailendra$

Same issue permission denied

No, both keys are not same. I have generated new public private pair for mac. and Added public entry in authorized_keys on the server. its just giving this error: “Permission denied (publickey).”

Kapil

If you are 100% sure that is the same private Key on your Mac as on your Windows machine then make sure that the on Mac is has 0400 permissions applied.

Just do a “chmod 0400 id_rsa”, this should work. If this doesn’t help then maybe you can provide the error message that you’re getting.