Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
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).

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

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
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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