[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#25589: Probably a bug in cp

From: Bernhard Voelker
Subject: bug#25589: Probably a bug in cp
Date: Tue, 31 Jan 2017 19:53:37 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0

On 01/31/2017 12:18 PM, Francesco Asnicar wrote:
> Dear all,
> I'm facing a problem with the cp command when using the -a (or
> --preserve=all) parameter.
> The problem is that the ownership of either files and folders is not
> preserved.
> I did several tests in which I tried to used different options, like
> --preserve=all instead of using -a, -p, and --preserve=ownership.
> I tried different version of cp present in different OS, for instance, the
> version 8.21 on a Ubuntu 14.04 and the version 8.26 on Arch (update as
> today).
> The result, regardless of the version and OS is always the same, the
> ownership is not preserved.
> Many thanks,
> Francesco

You did not provide an example, but I guess that you are running cp(1)
as a regular user.  From the documentation [1]:

        Preserve the owner and group. On most modern systems, only users
        with appropriate privileges may change the owner of a file, and
        ordinary users may preserve the group ownership of a file only
        if they happen to be a member of the desired group.

[1] http://www.gnu.org/software/coreutils/cp

So on a normal GNU/Linux system, you have to run the command as the root
user in order to successfully preserve the ownership.  Thus said, it's not
the cp(1) utility which is enforcing that rule, but the kernel (for a
good reason, of course).

Did you fall over this aspect?

Thanks & have a nice day,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]