Code Comments
Programming Forum and web based access to our favorite programming groups.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 Follow-up to this messagegazelle@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 Follow-up to this messageOn Sat, 23 Oct 2004 00:02:14 +0200, Steve Graegert wrote: > Kenny McCormack wrote: > % touch test The OP is discussing directories, not files.
Post Follow-up to this messagegazelle@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 Follow-up to this messageIn <417a13ff$0$36860$e4fe514c@news.xs4all.nl> Casper H.S. Dik <Casper.Dik@Su
n.COM> writes:
>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.
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 Follow-up to this messageIn 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 Follow-up to this messageIn 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 Follow-up to this messageIn 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 Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.