Reaped: Answer: Vroom testing some more has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's minimum standard of quality and will not be displayed.
  • Comment on How do I make two users have the same privileges?

Replies are listed 'Best First'.
Re: How do I make two users have the same privileges?
by Fastolfe (Vicar) on Dec 15, 2000 at 05:37 UTC
    As others have said, this isn't really a Perl issue, but what the heck.

    Firstly, make sure each user has an appropriate umask (of, say, '002' instead of a common default of '022'). This ensures that the users write files allowing write permissions to their group.

    Secondly, make sure Samba is running with a similar umask. This ensures files Samba creates are writable to the same group. Oh, make sure Samba is in the same group.

    Thirdly, you may wish to make use of the setgid bit in directory permissions, changing the group ownerships of the directories appropriately:

    $ ls -ld some_directory drwxr-xr-x 2 user group ... $ chmod 2775 some_directory $ ls -ld some_directory drwxrwsr-x 2 user group ...
    This ensure that any files or directories created under that directory will automatically be owned by the appropriate group. If all users writing files to these directories are set up with the same GID, though, this is probably redundant.
Re: How do I make two users have the same privileges?
by lemming (Priest) on Dec 15, 2000 at 02:34 UTC
    Not that this is really a Perl question:
    Look at smbusers and smbpasswd for guidance.
    Also, is the Windows user default group the shared one?
Re: How do I make two users have the same privileges?
by Daniellek (Sexton) on Dec 15, 2000 at 14:10 UTC
    Where's the perl question??? ;)

    But here you got, `man smb.conf` and look for these - especially for: "force user", "force group".

    o force create mode

    o force directory mode

    o force directory security mode

    o force group

    o force security mode

    o force user

    -- Daniellek
      Sorry about the non-perl question, but thanks for the advice. Actually, this came up as the result of running a perl script that creates files owned by apache, and then my wanting to edit those files under Samba, if that counts ....

      Anyway, I tried almost everything here. I made a smbusers file which sets apache = my samba user and added the line:

      username map = /usr/local/etc/smbusers

      to the global parameters of smb.conf.

      I set the umask for apache and the samba user to 002. I changed the setgidbit on the document root directory for apache where the script is creating the directories that my samba user can't modify. I wasn't sure how to make sure that Samba was a member of the apache group except to make sure that the windows user accessing the box via Samba is. It is.

      Finally, in the smb.conf file, I added the parameters force user = apache and force group = apache, since the user and group owners of the files created by the script are apache and apache respectively.

      As root, I did a killall -HUP init and I waited the requisite minute for samba to reinitialize from the conf file just to be sure.

      I can read the files created by the script via my windows share, but I still can't save modifications to them.

      I do appreciate any additional suggestions anyone may have, especially given that this is only loosely related (for me) to Perl.

        I don't believe a killall -HUP init will do anything at all to Samba. All that does is tell init to re-read /etc/inittab and make the appropriate adjustments. You probably want to HUP smbd.

        In addition, make sure that the files are writable by the group. Actually, if you're forcing Samba and Apache to run as the same user, I can't imagine any reason why it would be a permissions issue at that point. Verify they are indeed running as that user (via 'ps' output for example). If that isn't it, it's gotta be some additional Samba configuration item or something.

Re: How do I make two users have the same privileges?
by wardk (Deacon) on Dec 15, 2000 at 03:37 UTC

    I've not used Samba, so I am not sure if umask is relevent in this situation, but you may want to look at it, at least from the BSD users point of view.