2

Really need help here,

I made some mess into my /etc/passwd file, hoping that I can remove the user's password by removing its entry.

Upon saving it says cannot find name for user ID 1000. Now I can't do sudo or su - to access my superuser account because it always says Cannot determine your user name, I'm trying to edit the /etc/passwd again but unfortunately I don't have root access...

I'm stuck with an unknown user, and unfortunately I don't have any backup yet for the server.

Is this possible to be resolved without doing re-installation?

Any solution to fix this?

I badly needed this to be fixed..

Renesansz
  • 121
  • 1
  • 3
  • Can you log in as root through TTY? Can you mount the drive in a different computer and edit it there? – Paul Nov 25 '16 at 02:18
  • I tried logging in using `root` and my account password for Digital Ocean. but it says `Login Incorrect` – Renesansz Nov 25 '16 at 02:21
  • Does Digital Ocean have a virtual terminal/TTY, emergency login, etc? That is where you would log in using root. – Paul Nov 25 '16 at 02:22
  • yes, that's what I did. `Access >> Launch Console` – Renesansz Nov 25 '16 at 02:24
  • I have never used Digital Ocean. Perhaps you can save the image, move the image to some sort of file bucket, then grab the files you need and stick them in a new build? – Paul Nov 25 '16 at 02:26
  • Rackspace will create a new root login with every new build, even from old image, but not sure if Digital Ocean does the same thing. – Paul Nov 25 '16 at 02:27
  • I really hope your Digital Ocean account password is never stored in any of the account's servers. – Paul Nov 25 '16 at 02:29
  • I see, thanks for the tips, unfortunately it will cost some $ doing any backup or snapshot in DO so I'm trying to prevent any extra charges atm because it's my client who's paying for it, I still have a last option to `Reset Root Password` which will send a password change form to my email, hopefully this will resolve everything... – Renesansz Nov 25 '16 at 02:32

1 Answers1

4

Boot the system off of a live CD, mount your root filesystem, fix whatever you did to the file, then reboot.

And going forward, never edit that file directly. Instead, use the vipw command, which will prevent saving syntax errors most of the time.

EEAA
  • 108,414
  • 18
  • 172
  • 242