Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

What does 'S' mean in mode? And how to remove it?

223 views
Skip to first unread message

peng...@gmail.com

unread,
Dec 17, 2009, 6:36:03 PM12/17/09
to
I have a directory of mode 'drwx--Sr-x'. I'm wondering what 'S' means
and how to remove this mode.

Seebs

unread,
Dec 17, 2009, 6:41:10 PM12/17/09
to
On 2009-12-17, Peng...@gmail.com <peng...@gmail.com> wrote:
> I have a directory of mode 'drwx--Sr-x'. I'm wondering what 'S' means
> and how to remove this mode.

--S--S--S = mode 07000.
--S------ = mode 04000.
s = S+x

-s
--
Copyright 2009, all wrongs reversed. Peter Seebach / usenet...@seebs.net
http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!

Lew Pitcher

unread,
Dec 17, 2009, 6:45:46 PM12/17/09
to
On December 17, 2009 18:41, in comp.unix.shell, usenet...@seebs.net
wrote:

> On 2009-12-17, Peng...@gmail.com <peng...@gmail.com> wrote:
>> I have a directory of mode 'drwx--Sr-x'. I'm wondering what 'S' means

SetUID/SetGID/Sticky

>> and how to remove this mode.

chmod a-s


>
> --S--S--S = mode 07000.
> --S------ = mode 04000.
> s = S+x

--
Lew Pitcher
Master Codewright & JOAT-in-training | Registered Linux User #112576
Me: http://pitcher.digitalfreehold.ca/ | Just Linux: http://justlinux.ca/
---------- Slackware - Because I know what I'm doing. ------


Kaz Kylheku

unread,
Dec 17, 2009, 6:49:46 PM12/17/09
to
On 2009-12-17, Peng...@gmail.com <peng...@gmail.com> wrote:
> I have a directory of mode 'drwx--Sr-x'. I'm wondering what 'S' means
> and how to remove this mode.

I see you're posting from Linux, so it's likely you're asking abuot
the output of the GNU coreutils ``ls'' program from coreutils.

This has, like, documenation, y'know? Good ole RTFM:

$ info ls

[ ... search ... ]

The file mode bits listed are similar to symbolic mode
specifications (*note Symbolic Modes::). But `ls' combines
multiple bits into the third character of each set of permissions
as follows:


`s'
If the set-user-ID or set-group-ID bit and the corresponding
executable bit are both set.

`S'
If the set-user-ID or set-group-ID bit is set but the
corresponding executable bit is not set.

Keith Keller

unread,
Dec 17, 2009, 7:21:36 PM12/17/09
to
On 2009-12-17, Kaz Kylheku <kkyl...@gmail.com> wrote:
>
> This has, like, documenation, y'know? Good ole RTFM:
>
> $ info ls

Some people would not use "good" and "info" in the same sentence. ;-/

I almost never use the info pages, and don't expect others to use them
either. But I do note that, except for S, the symbolic modes are listed
in man chmod. But neither man page notes that S in the ls display is
equivalent to mode sx.

--keith


--
kkeller...@wombat.san-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://www.therockgarden.ca/aolsfaq.txt
see X- headers for PGP signature information

Seebs

unread,
Dec 17, 2009, 8:07:28 PM12/17/09
to
On 2009-12-18, Keith Keller <kkeller...@wombat.san-francisco.ca.us> wrote:
> I almost never use the info pages, and don't expect others to use them
> either. But I do note that, except for S, the symbolic modes are listed
> in man chmod. But neither man page notes that S in the ls display is
> equivalent to mode sx.

That's because it's not.

s is equivalent to Sx.

Greg Russell

unread,
Dec 17, 2009, 9:17:59 PM12/17/09
to
"Lew Pitcher" <lpit...@teksavvy.com> wrote in message
news:30c41$4b2ac2aa$4b77e0bb$16...@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".

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.


peng...@gmail.com

unread,
Dec 18, 2009, 10:21:22 AM12/18/09
to
On Dec 18, 5:45 pm, Lew Pitcher <lpitc...@teksavvy.com> wrote:
> On December 17, 2009 18:41, in comp.unix.shell, usenet-nos...@seebs.net
> wrote:

>
> > On 2009-12-17, PengYu...@gmail.com <pengyu...@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?

Bruce Bowler

unread,
Dec 18, 2009, 10:56:40 AM12/18/09
to
On Fri, 18 Dec 2009 07:21:22 -0800, Peng...@gmail.com wrote:

> On Dec 18, 5:45 pm, Lew Pitcher <lpitc...@teksavvy.com> wrote:
>> On December 17, 2009 18:41, in comp.unix.shell, usenet-nos...@seebs.net
>> wrote:
>>
>> > On 2009-12-17, PengYu...@gmail.com <pengyu...@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?

Have you heard of Google?

bb

unread,
Dec 18, 2009, 11:53:36 AM12/18/09
to

This permission is really a hack or a mistake.

It means that the owner can access it , and all others
can cd to it and list it if they are NOT member of the group.
All new files and directories in it will be crated with the same
group.

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.

Just do chmod 755, chmod g=rx or something and it will be fixed.
If you just do chmod g-s you have still a strange permission(705) that exclude
members of just that group, so check if that make sense , like if the group
is untrusted, sales, marketing or something.

/bb

Jon LaBadie

unread,
Dec 18, 2009, 1:20:59 PM12/18/09
to
Peng...@gmail.com wrote:
> On Dec 18, 5:45 pm, Lew Pitcher <lpitc...@teksavvy.com> wrote:
>> On December 17, 2009 18:41, in comp.unix.shell, usenet-nos...@seebs.net
>> wrote:
>>
>>> On 2009-12-17, PengYu...@gmail.com <pengyu...@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.

Sven Mascheck

unread,
Dec 18, 2009, 2:19:15 PM12/18/09
to
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).

Carbon

unread,
Dec 18, 2009, 3:49:26 PM12/18/09
to
On Thu, 17 Dec 2009 18:17:59 -0800, Greg Russell wrote:
> "Lew Pitcher" <lpit...@teksavvy.com> wrote in message
> news:30c41$4b2ac2aa$4b77e0bb$16...@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"

steven_nospam at Yahoo! Canada

unread,
Dec 18, 2009, 4:32:42 PM12/18/09
to
On Dec 17, 6:36 pm, "PengYu...@gmail.com" <pengyu...@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.

Martien Verbruggen

unread,
Dec 18, 2009, 5:20:57 PM12/18/09
to
On Fri, 18 Dec 2009 17:53:36 +0100,
bb <spam...@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...@heliotrope.com.au | Professor of Physiology at Toulouse,
| 1872

Luis P. Mendes

unread,
Dec 18, 2009, 6:16:27 PM12/18/09
to

Great post, thank you!

Luis

0 new messages