Help! lost /etc/passwd

we are testing on openldap at this node today, and runed one wrong file named "ldiftopasswd", therefore openldap removed the correct /etc/passwd file with empty LDIF data. and then we can't ssh in our linode now.

Is there any other way to get it back? or recover to at least can let root login?

Thanks.

5 Replies

If you have linode backups (or any other backups) enabled you can restore it from that (if using linode backups create a second node, restore the backup then copy the contents over via the lish shell when the broken linode is booted up using finnix recovery).

If you don't have backups you can boot up in rescue mode and copy a stock install version of the file to the server that will at least get root back. (note /etc/passwd doesn't actually contain the password)

You can boot your Linode using a Finnix recovery profile to get access to your system for maintenance. Then, mount your existing root filesystem and reset a basic passwd file to cover at least root login. (Or if you have a backup somewhere, you can restore the file when running under Finnix).

The Rescue tab in the Linode manager will set up a dynamic Finnix boot, or you can define an explicit configuration using the Finnix initrd and kernel. I find the latter makes it easier to maintain my desired disk image mapping for the recovery boot, but if you don't have one already, using the Rescue tab is definitely quicker/easier.

See also http://library.linode.com/troubleshooti … escue-mode">http://library.linode.com/troubleshooting/finnix-rescue-mode for some examples of the process.

-- David

Thanks a lot!! Rescue tab is really easy to use :)

How did you recover /etc/passwd from rescue mode, please help me. What to do after Finnix recovery profile I have got

[email protected]:~#

Now what to do??

Please don't necropost. But to answer your question you need to mount /dev/xvda or /dev/sda (most likely one of those) to say /mnt and then you'll be able to read the filesystem.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct