Operating System - HP-UX
1833051 Members
3215 Online
110049 Solutions
New Discussion

Preserving ownership with RCP

 
Johan Barelds
Frequent Advisor

Preserving ownership with RCP

Hi all,

I must copy a large amount of data from one server to another. On the original server isn't much space left anymore so i can't tar it. I tried to "rcp" it with the "-p" option to preserve ownership, but the owner changed to root. Can someone tell me how i can preserve ownership? (the uid's of the users are on the new server).

Thanks for any reply!

Grz .Bo
Make my day..:-)
9 REPLIES 9
Zeev Schultz
Honored Contributor

Re: Preserving ownership with RCP

rcp -p does preserve modification times and
modes but uses user/group ip of the user performing rcp as the owner.That can be understood from the rcp man page.
What can be used?
1)NFS mount with "cp -r"
2)rdist command.man rdist

Zeev
So computers don't think yet. At least not chess computers. - Seymour Cray
curt larson_1
Honored Contributor

Re: Preserving ownership with RCP

not the fastest way but should work for you;

cd fromDir; tar -cf - . | (remsh otherHost "cd toDir; tar -xf - ")

you'll need to set it up such that your not required to provide a passward, ie .rhosts etc.
Johan Barelds
Frequent Advisor

Re: Preserving ownership with RCP

Hi Zeev!

Thanks for your reply!
Since it has been a long time that i worked with rdist it's puzzles me a bit.

Do you have a small example of a distfile for only copying one dir from one server to another?

I don't find the manpage very simple on how to do that.

Thanks again!

Grz. Bo
Make my day..:-)
Robert-Jan Goossens
Honored Contributor

Re: Preserving ownership with RCP

Hi Bo,

Another example,

# find /dir | cpio -ov | remsh server "cd /dir ; cpio -idvum"

Hope it helps,

Robert-Jan.
Zeev Schultz
Honored Contributor

Re: Preserving ownership with RCP

Barelds,
See this thread on rdist:
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x6b99663ce855d511abcd0090277a778c,00.html
So computers don't think yet. At least not chess computers. - Seymour Cray
Johan Barelds
Frequent Advisor

Re: Preserving ownership with RCP

Hi all,

Thanks for all your help!
I do have rdist copying my files at this moment and it works just fine. I am certainly go and try all the other options you all provided.

Thanks again all!

Grz. Bo
Make my day..:-)
Zeev Schultz
Honored Contributor

Re: Preserving ownership with RCP

Or here:
http://docs.hp.com/hpux/onlinedocs/B2355-90147/00/00/85-con.html

basically build a distfile on source computer in following format:
HOSTS = (remote_host)
FILES = ( /dir1 /dir2 ...)
EXLIB = ( hosts.equiv ) #files not to
update on remote host
my_distribution:
$FILES -> $HOSTS install;
except /usr/include/$EXLIB;

Yeah its not that secure but should be fast at
least :)

Zeev
So computers don't think yet. At least not chess computers. - Seymour Cray
Johan Barelds
Frequent Advisor

Re: Preserving ownership with RCP

Yep!
I'v got it running and it's fast indeed!
I don't mind that's insecure: it's a closed environment.

Thanks again!
Grz. Bo
Make my day..:-)
Zeev Schultz
Honored Contributor

Re: Preserving ownership with RCP

(no points for this one)
actually if you want secure - can use rsync.
So computers don't think yet. At least not chess computers. - Seymour Cray