Showing results for 
Search instead for 
Did you mean: 

rcp and permissions

John Vetterkind
Occasional Contributor

rcp and permissions

When does rcp apply permissions? We have millions of files to move from one server to another and we are using rcp. I initiated the command from the source box using the -rp switches. When I look at the target the permissions are not the same as the source. Does rcp wait till the job is done?

Thanks in advance
Victor Fridyev
Honored Contributor

Re: rcp and permissions


AFAIK, rcp should preserve permissions on a target, after copy completing, but rsync is preferable. One can use it for copying files and, in addition to the fact that it preserves everything, in case of an interruptions of the process, repeated execution of rsync does not copy alredy copied files.

Entities are not to be multiplied beyond necessity - RTFM

Re: rcp and permissions

You may also consider using tar/pax to copy over mass quantities of files. This can preserve ownership and access dates.
Steven Schweda
Honored Contributor

Re: rcp and permissions

> [...] the permissions [...]

Which "the permissions"? On what, exactly?

> [...] Does rcp wait till the job is done?

I know nothing, but in some cases, it would
need to wait. For example, setting read-only
permissions on a directory before populating
that directory might make it rather difficult
to populate it. This argument holds for any
such program, not only "rcp". (Note that
directories are not actually _copied_ to the
destination, they are _created_ at the
destination, and populated with files which
are copied from the source. Permissions on
plain files can be set immediately, but not,
in general, those on directories. The
distinction between copying and creating a
directory is especially important if not all
the files in the source directory are being
copied. Everything's complicated.)

> [...] tar/pax [...]

That'd be my choice.

> [...] rsync does not copy alredy copied
> files.

So, if things are changing, the extra bother
of configuring "rsync" can be worth the
effort. In a static-source situation, I'd
likely choose a "tar"(-like) pipeline,
possibly with compression, depending on CPU
and network speeds, and other
situation-specific factors of which I know