/etc/passwd deleted

Hello all,

I accidentally deleted the /etc/passwd file from my OpenSuse10.3.
What can I do to get back in my OS?
Thanks

I don’t know how it is about in 10.3 but you should have a passwd.old in there or passwd.Yast2save. copy that and rename to passwd. After that you’d need to add your user with YaST again as it won’t probably be there.

> I accidentally deleted the /etc/passwd file from my OpenSuse10.3.
> What can I do to get back in my OS?

there may be another way, but the only way i know is to restore it
from your latest backup tape/image…


brassy

I have both in 10.3. So look inside wich one comes nearest (and look at their dates how old they are) to what you think your original was (in fact my passwd.old is exactly the same as passwd, so maybe you do not need to change something).

And I have a vague idea that you might be interested in reading: SDB:Login as root - openSUSE

Well i compared mine passwd.old and passwd and i didn’t have the actual user, i guess it is made every time there are any changes. So if you only added one user then in the passwd.old you won’t have that user in it BUT if you made some other changes then you should have yourself in there :slight_smile:

P.S. So after copying and renaming look into that file, if your actual user doesn’t exist then recreate him with YaST.Simple

But I don’t know how can I log in to my system because at login window after typing my user and password an error message is displayed “Login failed”. How can I bypass the login.

thanks!

Use any live CD to copy passwd.old and rename it to passwd. DVD will also suffice, just go to other terminals.

Either by booting into single user mode (enter s in the options field during boot), or use a cd/DVD in rescue mode.

Edit: orr a live CD as BenderBendingRodriguez says (we are fighting being first to answer you, see what you did to us :wink: ).
When boot is finished and you are loged in in the console after the boot (from live CD or whatever), mount the roor partition of your normal system somewhere, then you go there with cd and see what you have in etc/.

I tried to boot with s option but after switching to runlevel s I got some errors about services that could not start in runlevel s and also a message sulogin: cannot open password database.

I’ll try with an liveCD but this way (single user mod) it could be easier for me becouse I don’t have a liveCD right now.

Thank you very much … both of you!

You’re welcome and next time watch what you’re deleting :wink:

You can’t imagine how many files i lost when i started using linux :smiley:

So many photos and music lost ehhh those were the days rotfl!

Hm, I would forget those about services that can not be started. You do not really need them IMHO. But it is a pitty that it still needs the passwd file.

After that last message, you are sure you ar not loged in? Type the return key a few times.

How did you install? As long as you have any bootable CD/DVD that can run on itself (live CD, but also install ones with rescue mode, also from another openSUSE version or even from another Linux distribution) that would be OK.

BTW there is a second important file that holds information about users and login: /etc/shadow. Users have their passwords there and in general it has entries for every user in the same sequence as /etc/passwd. So when you restore a password.old check in /etc/shadow (especialy at the end) if there are more/less uers there. There is also shadow.old file which must correspond with passwd.old. So you could mv both to be the actual ones (but make a copy of shdow first).

I’ll try a liveCD! I tried to boot in single user mode because I didn’t have a liveCD and I installed OpenSuse from a DVD but … now I don’t have a dvdrom unit I only have a cdrom unit…it’s a little bit complicated:P. Anyway thanks a lot for helping me.