Find the answer to your Linux question:
Results 1 to 4 of 4
hi. i'm using ubuntu linux, here. i must be doing something wrong, but i read from this website: http://docsrv.caldera.com:507/en/man...C/chmod.C.html the following, about the "set group id" bit: Sets owner or ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Aug 2005
    Location
    Cincinnati, Ohio, USA
    Posts
    2

    "set group id" bit does not seem to be working


    hi. i'm using ubuntu linux, here. i must be doing something wrong, but i read from this website:
    http://docsrv.caldera.com:507/en/man...C/chmod.C.html
    the following, about the "set group id" bit:
    Sets owner or group ID on execution of the file to that of the owner of the file. The mode ``u+s'' sets the user ID bit for the file. The mode ``g+s'' sets the group ID bit. Other combinations have no effect. When the group ID bit is set on a directory, all files created under it subsequently receive the group ID of that directory. When the group ID bit is not set, files are created with the group ID of the creating process/user.

    i have a directory, called "submitted", for which i've set the "set group id" bit. if i do an "ls -l", i can see that the bit has been set:
    drwxrwsr-x 354 chris easyweaze 26496 2005-08-31 08:59 submitted

    now, i have a daemon running (mldonkey/mlnet) which downloads files to this directory. it runs under my user account, chris.

    so, from what i understand, any files created under this "submitted" directory should be given a group id of "easyweaze", since easyweaze is the group set for "submitted".

    however, when new files are downloaded to this directory, by mldonkey, they are owned by "chris", and have a group of "chris", as well:
    -rw-r--r-- 1 chris chris 99323665 2005-08-31 08:58 filename.rar

    what am i doing wrong?

    furthermore, i would like to have the files be "group writable", by default, as well, so that an application running with a group of "easyweaze" can write to the files. any thoughts on this would also be appreciated.

    thanks in advance!
    chris

  2. #2
    scm
    scm is offline
    Linux Engineer
    Join Date
    Feb 2005
    Posts
    1,044
    You're not doing anything wrong, the files should have a group of easyweaze when they're created. I can't explain why they haven't if the directory is set up as you've shown it (it works as you've described on my Fedora Core 2 system). Maybe a "feature" of ububtu?

    As for group writable, you need to make sure mldonkey runs with a umask of 002, not 022 which I believe is the default.

  3. #3
    Just Joined!
    Join Date
    Aug 2005
    Location
    Cincinnati, Ohio, USA
    Posts
    2
    when you say that "it works as you've described on my Fedora Core 2 system", do you mean you are actually running mldonkey and downloading to a directory with set gid bit set, or you're just creating files yourself in a directory with the bit set?

    i've found that creating files and directories "by-hand" (mkdir or using vi to create a new file) does what's expected: the files/directories have a group of easyweaze, and are readable/writable for user and group (because my umask is 002).

    however, if i use scp to transfer files from another computer, using the same user account to login at the destination host (the account with umask of 002), the files at the destination do have a group of easyweaze, but are not group-writable (note: the umask for both the source and destination accounts are 002). i also noticed that, when transferring a directory via scp, while the files for a given directory are transferring, the directory has its set-gid bit set, at the destination. however, after the transfer completes, the set-gid bit does not appear to be set.

    p.s. if i have a umask of 002 for my account, and i start mldonkey under my account, shouldn't it also run with a umask of 002?

    thanks!

  4. $spacer_open
    $spacer_close
  5. #4
    scm
    scm is offline
    Linux Engineer
    Join Date
    Feb 2005
    Posts
    1,044
    Mmm, interesting. Yes, I tested it by hand, creating files myself. I don't have your app. I can only assume that mldonkey is fiddling with the ownerships, possibly based on its own owner/group?

    Re. your p.s: a umask doesn't define which bits will be set, only those that won't, so a umask of 002 won't guarantee a file mode of group writable if the mode it was created with doesn't include that bit. (Does that make sense? It says what I mean, but may take a bit of parsing!)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •