Operating System - HP-UX
1834449 Members
2441 Online
110067 Solutions
New Discussion

Re: copying /etc/group & /etc/passwd file

 
kashifr
Advisor

copying /etc/group & /etc/passwd file

hi,
I am building a new server I want to copy all ids and groups from old to new server. What is the best way to do that using tar commnad?
thanx for help.
7 REPLIES 7
Pete Randall
Outstanding Contributor

Re: copying /etc/group & /etc/passwd file

Use:

tar -cvf /dev/rmt/0m /etc/passwd /etc/group

- then -

tar -x

to extract.


Pete

Pete
Dennis Handly
Acclaimed Contributor

Re: copying /etc/group & /etc/passwd file

You can use tar, but it seem silly for 2 files, unless you want to keep the dates and permissions.
$ tar -cvf pass_gr.tar /etc/group /etc/passwd

And to untar:
# tar -xvf pass_gr.tar

If you want to copy the files but merge the contents, you don't want to use absolute paths:

$ tar -cvf pass_gr.tar -C /etc group passwd
Dennis Handly
Acclaimed Contributor

Re: copying /etc/group & /etc/passwd file

Oops, I assumed you have NFS, FTP, etc available to the new server so you don't have to use the sneaker net. Pete explains how to use a tape.
DCE
Honored Contributor

Re: copying /etc/group & /etc/passwd file



don't forget /home, or where ever you have the user's individual data
Robert Salter
Respected Contributor

Re: copying /etc/group & /etc/passwd file

If you have a trusted system you may want to tar up the /tcb directory too.
Time to smoke and joke
Hein van den Heuvel
Honored Contributor

Re: copying /etc/group & /etc/passwd file

fwiw, For modest setups I have often simple used a terminal window copy & paste to make /etc/passwd and /etc/group match.

Be attentive to enhanced security requirements/files.

Hein.
Reshma Malusare
Trusted Contributor

Re: copying /etc/group & /etc/passwd file

Hi kashfir,
you can go for tar command or just simply copy & paste. but then chcek permissions on the file finally from security point of view.

Thanks,
Reshma