SSH broken after hostname change on EC2-hosted Ubuntu

Posted by dimadima on Server Fault See other posts from Server Fault or by dimadima
Published on 2012-11-26T00:05:31Z Indexed on 2012/11/26 5:06 UTC
Read the original article Hit count: 516

I changed my instance's hostname using the hostname utility and then set it in /etc/hostname so that the new name survives reboot.

My main motivation was for differentiating between instances at the prompt using the \h format in PS1.

EDIT I also changed permissions on my home directory. I made my home directory group writeable. END EDIT

Now I can no longer SSH into the machine. The short of it is the error Permission denied (publickey). Running ssh -v, the more verbose output is:

debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/dmitry/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Trying private key: /Users/dmitry/.ssh/ec2key.pem
debug1: read PEM private key done: type RSA
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
Permission denied (publickey).

Should I have done something after changing the hostname? Now I can't get into the instance! :(

© Server Fault or respective owner

Related posts about ubuntu

Related posts about amazon-ec2