From: Jon LaBadie on
PengYu.UT(a)gmail.com wrote:
> On Dec 18, 5:45 pm, Lew Pitcher <lpitc...(a)teksavvy.com> wrote:
>> On December 17, 2009 18:41, in comp.unix.shell, usenet-nos...(a)seebs.net
>> wrote:
>>
>>> On 2009-12-17, PengYu...(a)gmail.com <pengyu...(a)gmail.com> wrote:
>>>> I have a directory of mode 'drwx--Sr-x'. I'm wondering what 'S' means
>> SetUID/SetGID/Sticky
> What do these mean?
>

I agree with others that this question is one you can, and should, research
on your own rather than relying on C.U.Shell. It is a general unix question
and should be known early in anyone's progress in Shell Programming.

However, if after that research you pose the question "What is the effect of
the SetGID bit on a directory file?" that would be more reasonable. Still
researchable though. It may vary with OS and even FS-type.

Typically directories are setgid'ed if you want all newly created files to
have the same group membership as the directory itself. And possibly for
newly created subdirs to also have their setgid bit turn on to continue the
effect in the entire tree.
From: Sven Mascheck on
Jon LaBadie wrote:

> [...] It may vary with OS and even FS-type.
>
> Typically directories are setgid'ed if you want all newly created
> files to have the same group membership as the directory itself.

sometimes overlooked/omitted:
....except on BSDs, where this bit is usually not required, because
it's default (introduced with 4.4BSD), and documented in open(2).
From: Carbon on
On Thu, 17 Dec 2009 18:17:59 -0800, Greg Russell wrote:
> "Lew Pitcher" <lpitcher(a)teksavvy.com> wrote in message
> news:30c41$4b2ac2aa$4b77e0bb$16672(a)TEKSAVVY.COM-Free...
>
>>> I have a directory of mode 'drwx--Sr-x'. I'm wondering what 'S'
>>> means
>>
>> SetUID/SetGID/Sticky
>
> Bzzzzt ... wrong. The "sticky" bit is denoted by "chmod o+t ...", as
> in "ls -l / | grep tmp".

"ls -ld /tmp"

> Please don't continue to mis-inform others with the long-mistaken (and
> mis-stated) belief that because the word "sticky"starts with the
> letter "s", that it is denoted by same.
>
> "man chmod" for further information.
From: steven_nospam at Yahoo! Canada on
On Dec 17, 6:36 pm, "PengYu...(a)gmail.com" <pengyu...(a)gmail.com> wrote:
> I have a directory of mode 'drwx--Sr-x'. I'm wondering what 'S' means
> and how to remove this mode.

It's not the typical permissions I would expect to see.

If you know how the chmod and the modes are used, you know that there
are three sets of permissions, one for each ownership category:

User
Group
Other

Each group can have three "standard" permission settings of (r)ead, (w)
rite, and e(x)ecute. It decides who can do what with a file on the
system. So in my example file:

-rwxr-xr-- root staff example.file

If you ignore the leading "-" for a minute, you can break this down
as:

User = rwx (The "root" user has read, write, and execute permissions
to this file.)
Group = r-x (The "staff" members have read and execute option, but
cannot write to or update the file.)
Other = r-- (Anyone who is not root and not a member of staff group
has only read access to this file.)

Getting back to that leading "-" symbol, that is used to signify the
type of file that is represented. In the case of a "-" it is a
standard file. Others could be "d" for directory, "l" for a link, "c"
for character special file, or "b" for binary special file. There are
probably others, but that is not the focus here.

So where do the "s" or "S" come into the picture? Just as you can
break the permissions down into three sets, there is an S-bit setting
for each of those groups (the one on the "other" group is not used or
ignored). The active S-bits are usually referred to as the setuid or
setgid bit.

One of the things that the S-bit does is controls how other files get
created, allowing you to have permissions to create files as someone
OTHER than your default UID.

Here is an example:

If a directory called /reports has the permissions of drwxrws--- and
root:docusers, any reports (files) that get created in that directory
will have group ownership of "docusers", allowing everyone in the
group the ability to see that report. If it was not set this way and
root user creates a report through cron, it may show up as
root:system, and only root (or a member of system) would be able to
access that file.

For executable files such as compiled C-programs, the S-bit on the
user portion will cause the program to run as if it were being run by
the owner of the file. This has been used for certain utilities in the
past so that they can be run as if they had been started by root user.
A good example of this would be a program that is used to disable or
enable virtual printer queues. On some UNIX versions, you must be root
or a member of printq group to do this, but if you have a utility that
is owned by root that enables or disables the queues, anyone can run
it if the S-bit is on like this: -rwsr-xr-x and root:staff

A lowercase "s" means the S and the x are present. An uppercase "S"
means the x is not present.
The chmod numbers match up in this way (I hope this chart shows up
ok):
+__4__ +__2__ +__1__ +
| 4_2_1 | 4_2_1 | 4_2_1 |
| r_w_x | r_w_x | r_w_x |

So if you want "rwxr-sr--" as the permissions, you add the numbers:

Setgid = 2
User = 4+2+1 = 7
Group = 4+1 = 5
Other = 4

Result: chmod 2754

Hope this helps. And like others have mentioned, you can find this
info on Wikipedia under "UNIX permissions" and "setuid setgid" topics.
From: Martien Verbruggen on
On Fri, 18 Dec 2009 17:53:36 +0100,
bb <spamtrap(a)norsborg.net> wrote:
> The permission is 2705 and is maybe not possible to set for a normal user.
> I can set it on linux but not on my Solaris 10 sparc.

02705 is 1477 in decimal. Wonder wether someone has specified a decimal
number where an octal is required.

Martien
--
| Louis Pasteur's theory of germs is
Martien Verbruggen | ridiculous fiction -- Pierre Pachet,
first.last(a)heliotrope.com.au | Professor of Physiology at Toulouse,
| 1872