1753437 Members
4779 Online
108794 Solutions
New Discussion юеВ

rcp question

 
SOLVED
Go to solution
Nyck_1
Super Advisor

rcp question

I'm attempting to rcp a directory structure from servera to serverb and want to retain the permissions and ownerships. I'm sitting on the server where the data wants to be and i'm issuing the following command:-

rcp -rp servera:/devs/datablitz/cellc/BACKUP .

This works but its coming across owned by root:sys, what am I doing wrong?
7 REPLIES 7
Steven Schweda
Honored Contributor
Solution

Re: rcp question

> [...] what am I doing wrong?

Using "rcp"? "man rcp" ("-p") may be a
little ambiguous (and I don't see your HP-UX
version anywhere), but from what I've read,
it's not clear to me that "rcp -p" would
preserve owner:group.

Why not use a "tar" pipeline? (A quick forum
search for which should find examples and
additional reasons to avoid anything which
acts at all like "cp -r".)
Nyck_1
Super Advisor

Re: rcp question

Hello,

yeah I have just realised this after reading the man pages, D'oah.

I used rcp -rp in the end and changed the permissions once it finished and all was fine.
Steven Schweda
Honored Contributor

Re: rcp question

> I used rcp -rp [...] and all was fine.

Perhaps. For a possible reason to avoid
methods like "cp", see the demo in:

http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1203742

If you have no symbolic or (multiple) hard
links in what you copy, or if your "cp"-like
program is smarter than that one, then you
may escape this sort of hazard, but why take
the chance, when there's at least one more
trustworthy method?
Victor Fridyev
Honored Contributor

Re: rcp question

Hi,
For such copy I personally prefer tar:

remsh servera "cd /devs/datablitz/cellc; tar cf - BACKUP" |" cd /home; tar xf -"

Even better option is rsync, if you need to copy directory and after that to copy only updates
rsync -avH servera:/devs/datablitz/cellc/BACKUP /home/


HTH
Entities are not to be multiplied beyond necessity - RTFM
Sajjad Sahir
Honored Contributor

Re: rcp question

dear

u have to check u .rhosts file

if u want to execute command on second sever while u sitting on first one u can execute remsh

if u want to do rcp u should configure .rhosts file properly

thanks and regards

sajjad
Steven Schweda
Honored Contributor

Re: rcp question

> if u want to do rcp u should configure
> .rhosts file properly

Well, duh. Do you have any reason to believe
that he doesn't know this already? Or that
he hasn't done it already?

> This works but [...]

"This works" usually means that something
works. Or at least it does among people who
can spell "you".
Nyck_1
Super Advisor

Re: rcp question

Morning all,

yeah the first thing I did was the .rhosts file entry:-)