Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am running an Ubuntu Server (with ebox/zentyal installed). I believe it uses a combination of LDAP users and local users but I currently cannot login (through SSH) with any of them.

I was trying to fix a user problem on another box I was playing around with and accidentally pasted the following commands from a forum:

rm /etc/passwd
pwconv 
rm /etc/shadow
cp /etc/passwd- /etc/passwd
pwconv

So I am hoping I fixed my passwd file by restoring it from the /etc/passwd-, but I still can't login with my admin user (I still have a root terminal open though).

Any ideas on how to at least get my admin user to login through ssh again (it's a local user, not an LDAP one)?

I tried setting a new password with passwd admin but I am getting an Authentication Token Manipulation Error (which was the problem I was trying to solve in the first place).

Tried Danny's fix below:

root@server:/etc# useradd -G admin kribor
root@server:/etc# passwd kribor
passwd: Authentication token manipulation error
passwd: password unchanged
share|improve this question
    
Now is a good time to look into some backup, and recovery, options to make it easier in the future to fix problems like this ;) –  Cry Havok Sep 24 '11 at 22:13
    
Good point, I have weekly backup of my /etc, I'll look at that tomorrow. Any useful ideas, like which files I should look at restoring except the passwd & shadow files? –  Kristofer Sep 24 '11 at 23:45
    
That should be all you need to recover. –  Cry Havok Sep 25 '11 at 17:03
    
Yes and no... It covered the logins for the server but for some reason it broke the password to the zentyal web interface on the server. Still not sure why though –  Kristofer Sep 26 '11 at 15:43
add comment

1 Answer 1

up vote 2 down vote accepted

I'd start by using touch to recreate the shadow file, chmod'ing it to 0600 owned by root, and then using useradd to create a new user, and make sure they are in a wheel/admin group so they can sudo - this way you now at least have a method to get root commands on the box if something causes it to restart now.

You can then get some good info from this document. http://tldp.org/HOWTO/Shadow-Password-HOWTO-2.html - Points worth noting - the shadow file format, the usage of the crypt (3) command.

share|improve this answer
    
Afraid that did not work. –  Kristofer Sep 24 '11 at 23:46
    
I can't believe I panicked so much I didn't remember that I actually have a weekly backup of my /etc folder. Restoring passwd and shadow from there enabled me to log in again. I'm afraid that wont be much help for someone else reading this thread with the same problem though.. –  Kristofer Sep 25 '11 at 6:52
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.