Operating System - HP-UX
1753876 Members
7562 Online
108809 Solutions
New Discussion юеВ

Re: Your help on this.!!-/etc/passwd/ file has been corrupted in my server

 
E.Gopi Kannan
Occasional Advisor

Your help on this.!!-/etc/passwd/ file has been corrupted in my server

/etc/passwd/ file has been corrupted in my server.

how to restore it?
4 REPLIES 4
Bill Hassell
Honored Contributor

Re: Your help on this.!!-/etc/passwd/ file has been corrupted in my server

The easy answer is to restore the file from your most recent backup tape. I'll assume that you don't have a useful backup so the next step is to determine what is wrong with /etc/passwd.

Start with the command:

pwck

Show the errors reported by pwck. Do you know what happened to corrupt the passwd file? Did someone use vi for /etc/passwd but is not familiar with vi?


Bill Hassell, sysadmin
Ismail Azad
Esteemed Contributor

Re: Your help on this.!!-/etc/passwd/ file has been corrupted in my server

Hi,

Adding to bill's comments the pwck is a very useful command that is specifically designed for problems like yours. It would check all the attributes as well as the compulsory and essential fields in /etc/passwd especially in terms of syntax. Probably someone has missed a delimiter ":" while editting the passwd file and that is why changing the fields should be typically done by the firing of the command or by SMH. If users are not that important for some reason and you just want root authentication for login, look for the master template of passwd present in /usr/newconfig (however that is the worst last resort if there is no backup). Attempt to get out of the troubleshooting loop by examining the output of pwck or post output here. :)

Regards
Ismail Azad
Read, read and read... Then read again until you read "between the lines".....
Alzhy
Honored Contributor

Re: Your help on this.!!-/etc/passwd/ file has been corrupted in my server

If you regularly backup your OS -- then it should be relatively easy to extarct the pasword file from there.

It is best practice however to have some sort of a gen_dr_file.ksh script that gathers your important system fils on a daily basis and stash them say in /.dr . It's saved us many times.

You can also try rebuilfing your password file from /tcb (that is IF you're system is "trusted"/C2 config).

Hakuna Matata.

Re: Your help on this.!!-/etc/passwd/ file has been corrupted in my server

Dear Also if you have some DR backup site and has same configuration maintained on the DR server you can copy that /etc/passwd file as well by ftp. Also remember, Best practice for editing any critical file is to create its backup or copy first.

Best Regards,
Ali.