Linode Forum Index Linode Forum
Linode Community Forums
 


Help! lost /etc/passwd

Click here to go to the original topic

 
       Linode Forum Index -> General Discussion
Author Message
dwchiang



Joined: 27 Nov 2011
Posts: 3

Posted: Sun Nov 27, 2011 3:49 am    Post subject: 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.
Back to top  
obs



Joined: 07 Mar 2010
Posts: 1403
Location: Earth

Posted: Sun Nov 27, 2011 6:23 am    Post subject:  

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)
Back to top  
db3l



Joined: 13 May 2009
Posts: 556

Posted: Sun Nov 27, 2011 6:27 am    Post subject:  

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/troubleshooting/finnix-rescue-mode for some examples of the process.

-- David
Back to top  
dwchiang



Joined: 27 Nov 2011
Posts: 3

Posted: Sun Nov 27, 2011 7:55 am    Post subject:  

Thanks a lot!! Rescue tab is really easy to use :)
Back to top  
 
       Linode Forum Index -> General Discussion
Page 1 of 1