Operating System - HP-UX
1752571 Members
5229 Online
108788 Solutions
New Discussion юеВ

Re: Maintaining file ownership with scp and rcp

 
SOLVED
Go to solution
JohnSeel
Advisor

Maintaining file ownership with scp and rcp

On other flavors of UNIX that I have worked with, when using "scp -p" or "rcp -p" the file permissions and ownership of the file are maintained acrossed the copy.

With 11iv3, the file permissions are maintained, but the group and owner are changed to root and sys upon copying (as root) instead of the original owner/group.

I need to be able to copy user files between systems as root and maintain the user and group ownership.

Is there something I am missing or this a feature?

Thanks.
3 REPLIES 3
Steven Schweda
Honored Contributor
Solution

Re: Maintaining file ownership with scp and rcp

> Is there something I am missing or this a
> feature?

I know nothing, but I wouldn't expect it to
work. Or to be a good idea in most cases.
In general, I wouldn't expect the UID+GID
info to be compatible between different
systems, so preserving it could lead to many
kinds of trouble, especially if there's an
suid/sgid bit set somewhere.

> I need to be able to [...]

I'd normally use a "tar" pipeline, with an
rsh/remsh or ssh on one side. A Forum search
for keywords like, say,
tar pipeline
should find many examples in old threads.

> On other flavors of UNIX [...]

That's a little vague. I'm too lazy to run a
test, but a Solaris "man" page says "and
ACLs", but nothing explicit about
owner+group:

http://docs.sun.com/app/docs/doc/816-5165/rcp-1

Tru64 is more negative ("extended file
attributes (property list), including the
access control list (ACL), if any, are not
copied."):

http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V51B_HTML/MAN/MAN1/0306____.HTM
James R. Ferguson
Acclaimed Contributor

Re: Maintaining file ownership with scp and rcp

Hi:

The behavior you cite is expected. As Steven noted, one way to maintain both permissions and ownership ( the UID an GID ) is to copy a tar archive.

Regards!

...JRF...
JohnSeel
Advisor

Re: Maintaining file ownership with scp and rcp

I stand corrected. I was wrong. I went back to an old Tru64 system where I thought the UID and GID were maintained, ran an scp and rcp and they were not carried.

Oh, well. Ring this up to an overanxious imagination.

Thanks to all.