Răspuns: Răspuns: chmod behaviour
RuceLee
bors_ruslan at yahoo.com
Fri Nov 4 12:54:12 UTC 2011
Yes, this is it.
Does this apply to the older versions ? I'd have to check it out.
Thank you for all of your replies.
________________________________
De la: Jonathan S Billings <jsbillin at umich.edu>
Către: redhat-list at redhat.com
Trimis: Vineri, 4 Noiembrie 2011 13:29:56
Subiect: Re: Răspuns: chmod behaviour
On 11/04/2011 03:27 AM, RuceLee wrote:
> [root at core2duo ~]# chmod 0755 my_directory/ #set perm in octal mode
> [root at core2duo ~]# ll -d my_directory/ #no effect on SGIT bit
> drwxr-sr-x 2 root root 4096 Nov 4 08:16 my_directory/
>
> [root at core2duo ~]# chmod g-s my_directory/ #set perm in symbolic mode
> [root at core2duo ~]# ll -d my_directory/ #get back to the execution bit
> drwxr-xr-x 2 root root 4096 Nov 4 08:16 my_directory/
>
> I'm confused cuz up until now I assumed the octal and symbolic mode
> are interchangeable and here is an example where I rather have to use a
> single mode to get to expected result.
The documentation from coreutils:
https://www.gnu.org/s/coreutils/manual/html_node/Directory-Setuid-and-Setgid.html#Directory-Setuid-and-Setgid
Basically, you can't use the numeric modes to clear a directory's set-user-id and set-group-id bits. You have to use the symbolic mode to clear them.
The RHEL6 man page for 'chmod' actually mentions this in the "SETUID AND SETGID BITS" section:
chmod preserves a directory’s set-user-ID and
set-group-ID bits unless you explicitly specify
otherwise. You can set or clear the bits with
symbolic modes like u+s and g-s, and you can set
(but not clear) the bits with a numeric mode.
-- Jonathan Billings <jsbillin at umich.edu>
College of Engineering - CAEN - Unix and Linux Support
-- redhat-list mailing list
unsubscribe mailto:redhat-list-request at redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list
More information about the redhat-list
mailing list