I have an Amazon EC2 instance runnung Ubuntu 11.10. In an attempt to do a quick fix of a problem I changed the home diretory for the ubuntu user in the /etc/passwd to /srv/www. Now I can't ssh in to the box (I'm assuming) because it can't find .ssh/authorized_keys

I have FTP access to the box, and I can get access to the .ssh/authorized_keys file, but the directory /srv/www is owned by root so I can't just uploaded the .ssh folder there.

Any ideas?

link|improve this question
feedback

2 Answers

up vote 4 down vote accepted

A typical approach is to stop your instance (call it A) and create another instance where you mount A's disk and fix the problem (changing /etc/passwd in your case).

link|improve this answer
Awesome, Thank you! I didn't think of that, you're a lifesaver! – Brad Proctor Feb 4 at 21:51
feedback

Presuming that you have an EBS root volume, the simplest solution is likely:

  • Stop (don't terminate) the instance
  • Detach the EBS volume
  • Launch another instance
  • Attach your current EBS volume to the new instance
  • SSH into the new instance, mount the EBS volume and make the needed changes
  • Detach the EBS volume from new instance and attach it as the root volume of the old instance
  • Start the old instance
  • If everything is working, terminate the new instance
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.