cancel
Showing results for 
Search instead for 
Did you mean: 

cpio and ownership

Christian Gebhardt
Honored Contributor

cpio and ownership

Hi
I have problems with cpio and ownership of files. I have to copy some directories with different owners as root.

------
man cpio:

Duplicate a directory hierarchy:
cd olddir
find . -depth -print | cpio -pd newdir
-------

This works fine with HP-UX 11.00 but this doesn't work with 11.11. The file permissions are correct, but the owner of all files is root ??

Chris
6 REPLIES
Paul Sperry
Honored Contributor

Re: cpio and ownership

try cpio ???icxvdmu
Bill Douglass
Esteemed Contributor

Re: cpio and ownership

This may sound dumb, but what about tar? It will maintain permissions and ownership correctly, and can be use din a pipe like cpio.


tar cvf - /directory/path | tar -C /new/directory/path xf -

Also, the GNU version of tar handles large files without problem

http://hpux.cs.utah.edu/hppd/hpux/Gnu/tar-1.13.25/
S.K. Chan
Honored Contributor

Re: cpio and ownership

I just ran the same command on my 11.11 system and it was ok after I created "newdir" first as root. Have you checked if there's any cpio cumulative patch for 11.11 that may address this problem ?
Caesar_3
Esteemed Contributor

Re: cpio and ownership

Hello!

You talk that owner of your files on the
11i machine is root and on 11.00 machine someone else?
So change the permission as you want, if it's
nfs directory so check the export/mount options that you made.

Check to use the tar command it's good to.

Caesar
PIYUSH D. PATEL
Honored Contributor

Re: cpio and ownership

Hi Chris,

Try :

find . -depth -print | cpio -pdlmuv /newdir

HTH,
Piyush
Christian Gebhardt
Honored Contributor

Re: cpio and ownership

Hi

Thank you for your quick answers.

The problem was a large UID.
In this company they are using large UID's (above 64k) and cpio, tar from HP cannot work with this UID's. (No problem between 11.00 and 11.11)

So I tried Gnu-tar and it works.

Thanks

Chris