Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
 Post subject: Help! lost /etc/passwd
PostPosted: Sun Nov 27, 2011 4:49 am 
Offline
Newbie

Joined: Sun Nov 27, 2011 4:47 am
Posts: 3
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.


Top
   
 Post subject:
PostPosted: Sun Nov 27, 2011 7:23 am 
Offline
Senior Member

Joined: Sun Mar 07, 2010 7:47 pm
Posts: 1970
Website: http://www.rwky.net
Location: Earth
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)

_________________
Paid support
How to ask for help
1. Give details of your problem
2. Post any errors
3. Post relevant logs.
4. Don't hide details i.e. your domain, it just makes things harder
5. Be polite or you'll be eaten by a grue


Top
   
 Post subject:
PostPosted: Sun Nov 27, 2011 7:27 am 
Offline
Senior Member

Joined: Wed May 13, 2009 1:18 am
Posts: 681
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 for some examples of the process.

-- David


Top
   
 Post subject:
PostPosted: Sun Nov 27, 2011 8:55 am 
Offline
Newbie

Joined: Sun Nov 27, 2011 4:47 am
Posts: 3
Thanks a lot!! Rescue tab is really easy to use :)


Top
   
PostPosted: Fri Jul 24, 2015 9:17 am 
Offline

Joined: Fri Jul 24, 2015 9:12 am
Posts: 1
How did you recover /etc/passwd from rescue mode, please help me. What to do after Finnix recovery profile I have got

root@hvc0:~#

Now what to do??


Top
   
PostPosted: Fri Jul 24, 2015 9:21 am 
Offline
Senior Member

Joined: Sun Mar 07, 2010 7:47 pm
Posts: 1970
Website: http://www.rwky.net
Location: Earth
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.

_________________
Paid support
How to ask for help
1. Give details of your problem
2. Post any errors
3. Post relevant logs.
4. Don't hide details i.e. your domain, it just makes things harder
5. Be polite or you'll be eaten by a grue


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group