Re: Răspuns: chmod behaviour

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

 



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@xxxxxxxxx>
College of Engineering - CAEN - Unix and Linux Support

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



[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux