So I spun my instance up from the web, downloaded a keypair installed it and everything worked great for about a day. Then I rebooted my computer, and I'm not able to SSH into it anymore. I tried redownloading a keypair and reinstalling it but I keep getting the Permission denied (publickey) error.

This is the verbose output (I've tried using the -i /path/to/keypair option as well with no luck):

debug1: Reading configuration data /etc/ssh_config
debug1: Applying options for *
debug1: Connecting to ec2-184-73-218-40.compute-1.amazonaws.com [] port 22.
debug1: Connection established.
debug1: identity file /Users/tigger/.ec2/domainpolish type 1
debug1: identity file /Users/tigger/.ec2/domainpolish-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3p1 Debian-3ubuntu7
debug1: match: OpenSSH_5.3p1 Debian-3ubuntu7 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.6
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'ec2-184-73-218-40.compute-1.amazonaws.com' is known and matches the RSA host key.
debug1: Found key in /Users/tigger/.ssh/known_hosts:11
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/tigger/.ec2/domainpolish
debug1: Authentications that can continue: publickey
debug1: Offering RSA public key: domainpolish
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
Permission denied (publickey).

I've also tried rebooting the instance. Anyone have anything else I can try? Thanks so much!


The only thing I see in that log is roaming not allowed Are your keys type 1 or type 2?

Also check permissions on /Users/tigger/.ssh directory which should be owned by the user and be chmod 700. The authorized_keys file should also be chmod 700 and owned by the user.


Are you trying to log in with the right user? The Ubuntu images use the ubuntu user instead of root for example.

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.