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.
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! 🙁
Best Answer
Thankfully the root mount was running on an EBS volume. So, I was able to debug this issue by stopping the instance and attaching the EBS volume to another instance I had running. I then examined
/var/log/auth.log
, which provided the useful informationssh -v
was not providing. I noticed:Indeed, SSH was not happy that I had given group write perms to my home directory, while
StrictModes
was set toyes
in/etc/ssh/sshd_config
.More information on this issue can found at http://recursive-design.com/blog/2010/09/14/ssh-authentication-refused/ or by searching the Web for
SSH StrictModes
orAuthentication refused: bad ownership or modes for directory
.