Regain access to Ubuntu server

0

1

I did a stupid mistake on my Ubuntu virtual server (Amazon). I was messing around with /etc/passwd & /etc/group files and i am about to lock my self out of the server for good. I have a copy of the original passwd+group files but i cannot copy them back because every time i try to sudo i get :

sudo: unknown uid 1000: who are you?

I am still logged in. Is there anything i can try? I am afraid that after i log out there is no way to bring it back.

Thanks in advance.

ktsangop

Posted 2014-04-09T13:29:25.100

Reputation: 148

Answers

0

Unless you know the root password you won't be able to get root access to fix the /etc/passwd and /etc/group files. What you could do is:

  1. Stop the instance
  2. Create a new instance with the same AMI id
  3. Disconnect the volume from the first instance and connect it to the new instance
  4. Mount the volume and fix the config files
  5. Umount and disconnect the original instance's volume
  6. Connect the volume to the original instance

A more specific guide can be found at http://amazonserver.blogspot.nl/2013/01/recover-broken-amazon-ec2-instance.html

mtak

Posted 2014-04-09T13:29:25.100

Reputation: 11 805

1Will try this first thing tommorow and post back the results. Thanks a million! – ktsangop – 2014-04-09T13:47:40.987

I worked as a charm! Thank you again! Sorry i cannot upvote your answer also! – ktsangop – 2014-04-10T09:29:53.147