Operating System - HP-UX
1827006 Members
2286 Online
109712 Solutions
New Discussion

Copying the password file

 
dictum9
Super Advisor

Copying the password file


I have a number of accounts that need to be created. I just copied the /etc/passwd and /etc/group

when I rebooted the machine (for a different reason) I couldn't log in. I had to go into single user and recover the backed up passwd file.

Any suggestions on how to copy these users? I am thinking I will have to tar the home directory?
3 REPLIES 3
TwoProc
Honored Contributor

Re: Copying the password file

What you did should have worked, unless you've got servers in trusted mode, or you're using shadow passwords.

When you say "I couldn't log in" - do you mean root? Or "your user" account?

What was the error?

Generally, one can copy the line(s) for a user or set of users into a separate file, ditto for the groups. Then, go to the new server and append these new users and then, the new groups to each of the password and group files (respectively). At that point, you should run pwck (to check the password file), and then grpck (to check the group file). If all is OK, then you should be able to survive a reboot.
We are the people our parents warned us about --Jimmy Buffett
A. Clay Stephenson
Acclaimed Contributor

Re: Copying the password file

If this is a trusted system then you must copy /etc/passwd, /etc/group, and the entire /tcb tree. You should use a utility like cpio or tar so that permissions and ownerships are properly maintained. You will also need the home directories for normal use.

You should also be logged in as root in at least two sessions so that you can get yourself out of trouble almost as fast as you got yourself in.
If it ain't broke, I can fix that.
Darrel Louis
Honored Contributor

Re: Copying the password file

Hi,

I agree with the two others, when you perform such a action always do the following:
To perform a check, use the following commands:
# pwck
# grpck
On a trusted system run:
# authck
See man authck
# pwconv
For updating the tcb database

Darrel