Operating System - HP-UX
1837179 Members
2408 Online
110113 Solutions
New Discussion

Re: Copy NIS home directories to different server while preserving permissions.

 
SOLVED
Go to solution
TechC
Regular Advisor

Copy NIS home directories to different server while preserving permissions.

Hello,
I am trying to copy NIS home directories from one server to another. I am taking the box down and need to move the directories somewhere else.
I have tried cp -pr /source /mnt/destination.
That does not preserve permissions.
I have tried
tar -cpf - input | (cd /dest; tar -xpf -)
Is there a better way than this that someone can please suggest.
I have to move about 150 directories.
Thank you
James
7 REPLIES 7
Steven Schweda
Honored Contributor

Re: Copy NIS home directories to different server while preserving permissions.

> I have tried cp -pr [...]

"cp"? Ptui.

> I have tried
> tar [...]

And did it work?

That's the way I'd probably do it, but from
HP-UX to HP-UX, a similar fbackup - frecover
pipeline might have some advantage.

"man tar" suggests that the first "p" (the
one with "c") may have no effect.

> I have to move about 150 directories.

Moving many bits can take a while, no matter
how you do it. If you have fast CPUs and a
slow network, throwing some compression and
expansion (say, gzip) into the pipeline could
pay.


NIS doesn't really matter here, does it?
Dennis Handly
Acclaimed Contributor

Re: Copy NIS home directories to different server while preserving permissions.

I would have thought cp -p would work. Are you root on the machine? And if the new home directories are on NFS, are you root there too?

>Steven: throwing some compression and
expansion (say, gzip) into the pipeline could
pay.

I don't see any remsh, so where would gzip help?

>NIS doesn't really matter here, does it?

Perhaps James meant NFS?
TechC
Regular Advisor

Re: Copy NIS home directories to different server while preserving permissions.

Gentlemen, Thanks for the response.
What I meant was that I tried cp -pr from the source( an HPUX 10.20 box with NIS user home directories exported through NFS)
to a network appliance, did not work. Permissions are set to the nobody user..
I have root access on both..so then I tried from inside a home dir
tar -cf - . | (cd /destination ; tar -xf -)
to a destination homedir owned by the same user. The files are nobody(65344) owned still.
and I tried from inside source homedir again.
find . | cpio -pudlmv /destination home dir
The permissions are set to nobody or 65344 after the copy or tar or cpio function.
Could it be that it is a network appliance as the destination?
Should I be using what you posted as
cp"? Ptui
Thanks
James
Dennis Handly
Acclaimed Contributor
Solution

Re: Copy NIS home directories to different server while preserving permissions.

>Permissions are set to the nobody user. I have root access on both.

That's why I asked. You have root as nobody access, less than a normal user.

Since you have root on the network appliance, you need to export root as root. (Then change it back.)
See the following exportfs(1m), root=hostname[:hostname]...:
http://docs.hp.com/en/B2355-60103/exportfs.1M.html
(I have no idea how your network appliance exports, you may have a fancy GUI?)

Note: If you can't figure this out, you can always copy a tarfile over then untar it.

>tar -cf - . | (cd /destination ; tar -xf -)

You can simplify this by using:
$ cd /destination
$ tar -cf - -C source . | tar -xf -

Dennis Handly
Acclaimed Contributor

Re: Copy NIS home directories to different server while preserving permissions.

Something strange in what you're asking. If you have a network appliance and NIS, why aren't your home directories already there?
(Or is that what you are doing?)

My home directory is like that.
TechC
Regular Advisor

Re: Copy NIS home directories to different server while preserving permissions.

Bingo Dennis, I exported the volume I needed to copy to with root access to the source (old NIS master server) and it works like a charm...Man I should have caught that. I guess I figured since the folder was wide open it would be OK. Better study up on my NFS.
The netapp is relatively new so that is why I am putting the home directories there now. Gonna retire this 10.20 box. I am also moving the NIS services to a different box but before I do so I wanted to have all the home dirs off.
Thanks again for the advice on pre turkey day.
I sure do appreciate it.
James
TechC
Regular Advisor

Re: Copy NIS home directories to different server while preserving permissions.

Dennis' answer did the trick..Root over NFS is nothing. Someone made that clear to me in the past..I guess I did not listen.
Anyhow Thanks Dennis.