Unix Programming - Re: chmod: Why must "g+s" be specified symbolically (at least in

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > October 2004 > Re: chmod: Why must "g+s" be specified symbolically (at least in





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Re: chmod: Why must "g+s" be specified symbolically (at least in
Steve Graegert

2004-10-22, 5:53 pm

Kenny McCormack wrote:
> According to "man chmod" on Solaris, "g+s" (aka, the 2000 bit) must be
> specified symbolically (that is as "g+s", not as 2000). And, indeed, my
> testing shows this to be the case. "chmod 2755 /some/dir" sets it to 755.
>
> Questions
> 1) Why is this?
> 2) Is it true on any other Unixes?
>


Hi Kenny,

the first octal digit specifies, whether the set user id (4), the set
group id (2) or the sticky bit (1) shall be set. Testing on SunOS 5.6
gives the following:

% touch test
% ls -l test
-rw-r--r-- 1 steve staff 0 Oct 22 23:35 test
% chmod 1644 test
-rw-r--r-T 1 steve staff 0 Oct 22 23:35 test
% chmod 2644 test
-rw-r-Sr-- 1 steve staff 0 Oct 22 23:35 test
% chmod 4644 test
-rwSr--r-- 1 steve staff 0 Oct 22 23:35 test
% chmod g+s test
-rwSr-Sr-- 1 steve staff 0 Oct 22 23:35 test
% chmod 2000 test
------S--- 1 steve staff 0 Oct 22 23:35 test

Can't see anything unusal here. Specifying the suid/sgid/sticky bit can
be done either using numerical notation or the symbolic constant s. This
is also true with Tru64 Unix 5.1b. If you have other experiences, just
let me know.

\Steve.
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com