Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Red Hat Linux (http://www.linux-archive.org/red-hat-linux/)
-   -   Răspuns: Răspuns: chmod behaviour (http://www.linux-archive.org/red-hat-linux/594573-rae-spuns-rae-spuns-chmod-behaviour.html)

RuceLee 11-04-2011 11:54 AM

Răspuns: Răspuns: chmod behaviour
 
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@umich.edu>
Către: redhat-list@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@core2duo ~]# chmod 0755 my_directory/ #set perm in octal mode
> [root@core2duo ~]# ll -d my_directory/ #no effect on SGIT bit
> drwxr-sr-x 2 root root 4096 Nov* 4 08:16 my_directory/
>
> [root@core2duo ~]# chmod g-s my_directory/ #set perm in symbolic mode
> [root@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@umich.edu>
College of Engineering - CAEN - Unix and Linux Support

-- redhat-list mailing list
unsubscribe mailto:redhat-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list
--
redhat-list mailing list
unsubscribe mailto:redhat-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list


All times are GMT. The time now is 11:11 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.