Operating System - HP-UX
1820623 Members
1817 Online
109626 Solutions
New Discussion юеВ

Re: /etc/passwd is corrupted...

 
SOLVED
Go to solution

/etc/passwd is corrupted...

Hi, all!
Couldn't you please help recover file passwd?
He is corrupted. I copied the same file from the same station in /home/userlogin. How replace corrupted file in /etc?
Thanx in advance, Oleg.
19 REPLIES 19
Robert-Jan Goossens
Honored Contributor

Re: /etc/passwd is corrupted...

Hi Oleg,

Do you still have a login session ?

Robert-Jan
Naveej.K.A
Honored Contributor

Re: /etc/passwd is corrupted...

You need root access!!!

Give a try with the command pwchk. I don't think it will repair corrupted files.

From your post, it looks like you have the backup copy in /home/userlogin.

cp /etc/passwd /etc/passwd.orig
cp /home/userlogin/passwd /etc/passwd

Regards,
Naveej
practice makes a man perfect!!!

Re: /etc/passwd is corrupted...

Hi, Robert-Jan,
I have one login session without root's rights.
Oleg
Robert-Jan Goossens
Honored Contributor

Re: /etc/passwd is corrupted...

Naveej gave you the answer above.

copy the saved passwd file back to the /etc directory

# cp /home/userlogin/passwd /etc/passwd

# pwck

to check if this password file is good.

Robert-Jan
Steven E. Protter
Exalted Contributor

Re: /etc/passwd is corrupted...

You are going to have to boot single user mode and rebuild.

Boot
Probably via power switch

interupt at the 10 second prompt

BO

Y Interact
hpux -is

You can then do this:

mount /var
mount /tmp

You should then be able to read a backup tape and restore the damaged files in /etc

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Devender Khatana
Honored Contributor

Re: /etc/passwd is corrupted...

Hi,

As guided by Steven you can come to single user mode. Here you do not require to enter old root passwd. It will come to # prompt straight away. Here you can play with your file and even set a new root passwd.

You can copy sample passwd file from /usr/newconfig/etc directory. But by doing so you will have to update it for all users which were there on system. This can be done if your existing passwd file can give you the information of atleast the existing user accounts. Another good thing to do will be copy sample file, update root account, reboot to multiuser mode and then restore file from backup.( With 2-3 session having logged in as root)

HTH,
Devender
Impossible itself mentions "I m possible"

Re: /etc/passwd is corrupted...

Thanks all, but...
I have only one login without root's rights and I can't copy "normal" passwd from /home/username to /etc becouse for /etc username haven't permissions.Please tell me can I copy passwd from /home/username to /etc in Single User Mode? (no from tape)
Oleg
Naveej.K.A
Honored Contributor

Re: /etc/passwd is corrupted...

Oleg,

Once you boot into the single user mode and follow the steps outlined by Steve, you will be logged in as root and will have enough permissions to copy the password file.

Regards,
Naveej
practice makes a man perfect!!!
Steven E. Protter
Exalted Contributor

Re: /etc/passwd is corrupted...

Either copy or issue the useradd command and manually rebuild the passwd database.

You really need to have backups of this file regularly.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com

Re: /etc/passwd is corrupted...

Thanx all for you attention!
And now I have question about security: If some bad guy will want to change of accounts of some station he could do it if will have "phisical" access to station and keyboard?
Naveej.K.A
Honored Contributor
Solution

Re: /etc/passwd is corrupted...

Yes very easily a "bad guy" can do this, if he is knowledgable enough. This is when the datacenter environmental and physical access/security comes into picture. The datacenter or the room where you place the server should be secure enough and the access should be restricted through access cards/codes, finger print verification, etc.

Regards,
Naveej
practice makes a man perfect!!!

Re: /etc/passwd is corrupted...

Naveej - You told me not funny thing...;)))
Steven E. Protter
Exalted Contributor

Re: /etc/passwd is corrupted...

The most important aspect of security is physical security.

The unit needs to be in a locked office if its powerful and access can be used to damage other Unix systems.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com

Re: /etc/passwd is corrupted...

I hope what I not bad guy :), but may be somebody can take some links at manual how change accounts in single user mode. I failed with restore passwd. OS don't see accounts - "say" what "Account is disabled -- see Account Administrator".What to do? Please help!
Thanx in advance. Oleg
T G Manikandan
Honored Contributor

Re: /etc/passwd is corrupted...

Login into single user mode and then you can mount /usr

then you can edit the /etc/passwd file and remove the encrypted password entry in one of the fields to enable root login.

Then you can manipulate all other users.

What;s the feedback on the single user mode login!!
Naveej.K.A
Honored Contributor

Re: /etc/passwd is corrupted...

Oleg,

Interupt the boot throug the console at the 10 second prompt

bo

Y Interact

hpux -is

You will now boot single user mode.


Is your system in trusted mode??
To check this
do a ls -l /tcb/files/auth/r

if any files like root are there, then your system could be in trusted mode.

# mount -a
# usr/lbin/tsconvert -r
this untrusts the system

do # passwd root

Changes the password

# /usr/lbin/tsconvert -rto put the system trusted.

Regards,
Naveej


practice makes a man perfect!!!

Re: /etc/passwd is corrupted...

Thank guys, how I understand, in passwd I can myself edit from keyboard "field" of password (I see it "coded") of needed accounts? Where I can take manual about?
Naveej.K.A
Honored Contributor

Re: /etc/passwd is corrupted...

Hi,

The password in the password field are encrypted and can't be edited to include the password of your choice. But you can always null it and the user will have a null password.

eg:

abc:&63936^HDUDh/hc:101

to

abc::101

Regards,
Naveej
practice makes a man perfect!!!
T G Manikandan
Honored Contributor

Re: /etc/passwd is corrupted...

check

#man 4 passwd

to find out the manual pages for the file