Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 07 Feb 2008 19:07:11 +0100
From:      Pietro Cerutti <gahr@gahr.ch>
To:        User Questions <freebsd-questions@freebsd.org>
Subject:   cp -p 
Message-ID:  <47AB48CF.1020804@gahr.ch>

next in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enig7A3FC675188BF95AFFD97EE5
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Hi list,

here's the situation:

HostServer exports via NFS /www, which belongs to user:www
(uid=3D1001, gid=3D80). The directory has the segid flag set:

drwsr-xr-x  13 user www 512 Feb 7 00:58 www

HostClient mounts the exported directory on /share/www. HostClient
doesn't know anything about gid 80.

Now, on HostClient, user copies aFile to /share/www using the -p flag of
cp(1).

> cp -p aFile /share/www/
> ls -l
-rw-------  1 user user  2981888 Feb  7 01:09 /www/aFile

As shown, the setgid flag of /www hasn't worked.

Now in man cp, I can read the following:

"If the source file has its set-user-ID bit on and the user ID cannot be
preserved, the set-user-ID bit is not preserved in the copy's
permissions.  If the source file has its set-group-ID bit on and the
group ID cannot be preserved, the set-group-ID bit is not preserved in
the copy's permissions. If the source file has both its set-user-ID and
set-group-ID bits on, and either the user ID or group ID cannot be
preserved, neither the set-user-ID nor set-group-ID bits are preserved
in the copy's permissions."

I cannot find anywhere information such as "If the /*destination*/ file
directory has its set-group-ID bit on and the group-ID cannot be
preserved, the set-group-ID bit is not preserved in the copy's permission=
s."

Assuming that this is the correct and expected behavior, why is it like
this?

Thank you,


--=20
Pietro Cerutti

PGP Public Key:
http://gahr.ch/pgp


--------------enig7A3FC675188BF95AFFD97EE5
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (FreeBSD)

iD8DBQFHq0jTwMJqmJVx944RCtXZAJ4ly0WsDGcy0i2LlXcCwzzFWE2KLgCgodop
SBflmiZjcEP0M7wf+gdiJL0=
=A2Ez
-----END PGP SIGNATURE-----

--------------enig7A3FC675188BF95AFFD97EE5--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?47AB48CF.1020804>