chmod: Why must "g+s" be specified symbolically (at least in Solaris) ?
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > chmod: Why must "g+s" be specified symbolically (at least in Solaris) ?




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    chmod: Why must "g+s" be specified symbolically (at least in Solaris) ?  
Kenny McCormack


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
10-22-04 10:53 PM

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?






[ Post a follow-up to this message ]



    Re: chmod: Why must "g+s" be specified symbolically (at least in Solaris) ?  
Pascal Bourguignon


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
10-22-04 10:53 PM

gazelle@yin.interaccess.com (Kenny McCormack) writes:

> 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?

I can't see any valid reason why.


> 	2) Is it true on any other Unixes?

It's not true on linux, nor on NeXTSTEP, OPENSTEP or MacOSX (4.3SBD,  4.4BSD
).

--
__Pascal Bourguignon__                     http://www.informatimago.com/

Voting Democrat or Republican is like choosing a cabin in the Titanic.





[ Post a follow-up to this message ]



    Re: chmod: Why must "g+s" be specified symbolically (at least in Solaris) ?  
Dave Uhring


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
10-22-04 10:53 PM

On Sat, 23 Oct 2004 00:02:14 +0200, Steve Graegert wrote:

> Kenny McCormack wrote: 
[vbcol=seagreen]
> % touch test

The OP is discussing directories, not files.






[ Post a follow-up to this message ]



    Re: chmod: Why must "g+s" be specified symbolically (at least in Solaris) ?  
Casper H.S. Dik


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
10-23-04 07:47 AM

gazelle@yin.interaccess.com (Kenny McCormack) writes:

>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.

Absolute changes do not work for the set-group-ID bit  of  a
*directory*. You must use g+s or g-s.

>Questions
>	1) Why is this?

To make set-gid inheritance work for directories and prevent you
from accidentily removing it.

Casper
--
Expressed in this posting are my opinions.  They are in no way related
to opinions held by my employer, Sun Microsystems.
Statements on Sun products included here are not gospel and may
be fiction rather than truth.





[ Post a follow-up to this message ]



    Re: chmod: Why must "g+s" be specified symbolically (at least in Solaris) ?  
Gary Mills


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
10-23-04 10:48 PM

In <417a13ff$0$36860$e4fe514c@news.xs4all.nl> Casper H.S. Dik <Casper.Dik@Su
n.COM> writes:

>gazelle@yin.interaccess.com (Kenny McCormack) writes:
 
[vbcol=seagreen]
>    Absolute changes do not work for the set-group-ID bit  of  a
>    *directory*. You must use g+s or g-s.
 
[vbcol=seagreen]
>To make set-gid inheritance work for directories and prevent you
>from accidentily removing it.

We ran into this problem with Casper's install_check script.
Here's what I had to do to fix it:

dontfix || {
mkdir -p $dir &&
chown $owner $dir &&
chgrp $group $dir &&
chmod $mode $dir
case $mode in
2???)
chmod g+s $dir
;;
esac
} || error "Can't mkdir $dir"


--
-Gary Mills-    -Unix Support-    -U of M Academic Computing and Networking-





[ Post a follow-up to this message ]



    Re: chmod: Why must "g+s" be specified symbolically (at least in Solaris) ?  
Kenny McCormack


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
10-23-04 10:48 PM

In article <417a13ff$0$36860$e4fe514c@news.xs4all.nl>,
Casper H.S. Dik  <Casper.Dik@Sun.COM> wrote:
>gazelle@yin.interaccess.com (Kenny McCormack) writes:
> 
>
>    Absolute changes do not work for the set-group-ID bit  of  a
>    *directory*. You must use g+s or g-s.
> 
>
>To make set-gid inheritance work for directories and prevent you
>from accidentily removing it.

Aha.  I see.  So that if you do your normal: chmod 755 .
it won't have any effect on this bit.  And I see now that this property
does in fact inherit down the tree.

Quite natty, in fact.  Wonder why other Unixes didn't follow suit.
(Linux does do the inheritance thing.  But the chmod program doesn't
require g+s/g-s)






[ Post a follow-up to this message ]



    Re: chmod: Why must "g+s" be specified symbolically (at least in Solaris) ?  
Scott Howard


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
10-24-04 01:46 AM

In comp.unix.solaris Kenny McCormack <gazelle@yin.interaccess.com> 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?

To stop you accidently removing it by typing (say) chmod 755.
It's basically separating the feature that g+s sets from the permissions
that chmod xxx sets.

That fact that you also need to add it using g+s is really just a side
effect, rather than a specific feature.

Scott





[ Post a follow-up to this message ]



    Re: chmod: Why must "g+s" be specified symbolically (at least in Solaris) ?  
Randy Howard


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
10-27-04 07:49 AM

In article <4179e4c7$0$59445$ed2619ec@ptn-nntp-reader03.plus.net>,
beardy@beardy.net says...
>
> Yup - you have to be pretty determined/certain to hold the shit key down

I still have a "Dammit!" key that came with a bunch or marketing crap one
time years ago, which sits where the "Esc" key used to be, but I've never
seen a "Shit" key.  It's a good idea though.


--
Randy Howard (2reply remove FOOBAR)






[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 03:26 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register