Unix Permissions Question - Hewlett Packard

This is a discussion on Unix Permissions Question - Hewlett Packard ; An ls command shows the following permissions on a file: drwxrws--- My question is this: what is the function of 's' in the executable placeholder for group? How does it differ from 'x' ? Help is greatly appreciated. CJ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: Unix Permissions Question

  1. Unix Permissions Question

    An ls command shows the following permissions on a file:

    drwxrws---

    My question is this: what is the function of 's' in the executable
    placeholder for group? How does it differ from 'x' ?

    Help is greatly appreciated.
    CJ


  2. Re: Unix Permissions Question

    carole.jesse@gmail.com wrote:
    > An ls command shows the following permissions on a file:
    >
    > drwxrws---
    >
    > My question is this: what is the function of 's' in the executable
    > placeholder for group? How does it differ from 'x' ?
    >
    > Help is greatly appreciated.


    That means that the setgid ("set group id") bit is set for that file.
    When the file is executed it changes the effective group id of the process
    to the group to which the file belongs. For instance, if you're a member
    of a group called "users" and you execute a file that belongs to a group
    called "system" with permissions like this:

    drwxrwx---

    then the process will have an effective group id of "users." But if
    the permissions are set like this:

    drwxrws---

    then the effective group id of the process will be "system." In other
    words, when you execute this file it will behave just as if it were
    executed by someone who is a member of the "system" group rather than the
    "users" group.

    --
    Wayne Brown (HPCC #1104)

    s ofereode, isses swa mg. ("That passed away, this also can.")
    from "Deor," in the Exeter Book (folios 100r-100v)

  3. Re: Unix Permissions Question

    On Mar 5, 12:14 pm, Wayne Brown wrote:
    > carole.je...@gmail.com wrote:
    > > An ls command shows the following permissions on a file:

    >
    > > drwxrws---

    >
    > > My question is this: what is the function of 's' in the executable
    > > placeholder for group? How does it differ from 'x' ?

    >
    > > Help is greatly appreciated.

    >
    > That means that the setgid ("set group id") bit is set for that file.
    > When the file is executed it changes the effective group id of the process
    > to the group to which the file belongs. For instance, if you're a member
    > of a group called "users" and you execute a file that belongs to a group
    > called "system" with permissions like this:
    >
    > drwxrwx---
    >
    > then the process will have an effective group id of "users." But if
    > the permissions are set like this:
    >
    > drwxrws---
    >
    > then the effective group id of the process will be "system." In other
    > words, when you execute this file it will behave just as if it were
    > executed by someone who is a member of the "system" group rather than the
    > "users" group.
    >
    > --
    > Wayne Brown (HPCC #1104)
    >
    > s ofereode, isses swa mg. ("That passed away, this also can.")
    > from "Deor," in the Exeter Book (folios 100r-100v)


    Thanks Wayne. I could not find any reference to this in any UNIX book
    I have (a library with a whopping 2 books in it!). So is it safe to
    say that the owner of this file used a chmod command like this to
    create those permissions in the first place?:

    chmod g+s filename


  4. Re: Unix Permissions Question

    carole.jesse@gmail.com wrote:
    > On Mar 5, 12:14 pm, Wayne Brown wrote:
    >> carole.je...@gmail.com wrote:
    >> > An ls command shows the following permissions on a file:

    >>
    >> > drwxrws---

    >>
    >> > My question is this: what is the function of 's' in the executable
    >> > placeholder for group? How does it differ from 'x' ?

    >>
    >> > Help is greatly appreciated.

    >>
    >> That means that the setgid ("set group id") bit is set for that file.
    >> When the file is executed it changes the effective group id of the process
    >> to the group to which the file belongs. For instance, if you're a member
    >> of a group called "users" and you execute a file that belongs to a group
    >> called "system" with permissions like this:
    >>
    >> drwxrwx---
    >>
    >> then the process will have an effective group id of "users." But if
    >> the permissions are set like this:
    >>
    >> drwxrws---
    >>
    >> then the effective group id of the process will be "system." In other
    >> words, when you execute this file it will behave just as if it were
    >> executed by someone who is a member of the "system" group rather than the
    >> "users" group.

    >
    > Thanks Wayne. I could not find any reference to this in any UNIX book
    > I have (a library with a whopping 2 books in it!). So is it safe to
    > say that the owner of this file used a chmod command like this to
    > create those permissions in the first place?:
    >
    > chmod g+s filename


    Yes, that would do it, if the execute bit already was set at the group
    level. If not, then the command you listed would have produced drwxrwS---
    (note the capital S) instead. chmod g+sx would have set both the setgid
    and execute bits at the same time and produced drwxrws--- regardless of
    whether the x bit already was set.

    I just now noticed that the example you gave was not a regular file but
    a directory. The effect of setgid is a little different in that case.
    Having the setgid bit set for a directory means that files created in
    that directory will be belong to the same group as the directory itself.
    (Normally, when a file is created it will belong to the same group as
    the user who created it.)

    Here's a web page that explains all this:

    http://www.greenend.org.uk/rjk/2004/perms.html

    --
    Wayne Brown (HPCC #1104)

    s ofereode, isses swa mg. ("That passed away, this also can.")
    from "Deor," in the Exeter Book (folios 100r-100v)

+ Reply to Thread