Question

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

Posted January 21, 2019 1.2k views
Debian

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

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.

×
3 answers

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.

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

OpenSSH7.9p1, LibreSSL 2.7.3
debug1: Reading configuration data /etc/ssh/ssh
config
debug1: /etc/ssh/sshconfig 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 OpenSSH7.6p1 Ubuntu-4ubuntu0.3
debug1: match: OpenSSH
7.6p1 Ubuntu-4ubuntu0.3 pat OpenSSH7.0*,OpenSSH7.1,OpenSSH_7.2,OpenSSH7.3*,OpenSSH7.4,OpenSSH_7.5,OpenSSH7.6*,OpenSSH7.7* compat 0x04000002
debug1: Authenticating to 139.59.49.53:22 as ‘root’
debug1: SSH2MSGKEXINIT sent
debug1: SSH2MSGKEXINIT 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 SSH2MSGKEXECDHREPLY
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/knownhosts:17
debug1: rekey after 134217728 blocks
debug1: SSH2
MSGNEWKEYS sent
debug1: expecting SSH2
MSGNEWKEYS
debug1: SSH2
MSGNEWKEYS received
debug1: rekey after 134217728 blocks
debug1: Will attempt key: zenkins RSA SHA256:HPZUOgZLyxAzCG1mtY7689Bs+cD6CEasu913m2TLUzo explicit
debug1: SSH2
MSGEXTINFO received
debug1: kexinputextinfo: 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
MSGSERVICEACCEPT 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

Submit an Answer