Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
add comment

2 Answers 2

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
add comment

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
add comment

Your Answer

 
discard

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.