RE: [SLUG] SAMBA and user rights

From: Grantham, Patrick (Patrick.Grantham@vacationclub.com)
Date: Thu Aug 02 2001 - 19:05:52 EDT


Thanks, but how do I configure do this for files created by samba and ftp?

-----Original Message-----
From: Ian C. Blenke [mailto:icblenke@nks.net]
Sent: Thursday, August 02, 2001 6:26 PM
To: slug@nks.net
Subject: Re: [SLUG] SAMBA and user rights

On Thu, Aug 02, 2001 at 05:16:20PM -0400, Grantham, Patrick wrote:
> I am finding that when a new file (or folder) is created by MS client on
the
> linux samba share, the user that samba is running (root) is the owner of
the
> file. This is not ideal since some content is edited (and/or created) via
> ftp. How can I change this setting? I would prefer that when a file is
> created that the owner becomes nobody, the group is webdev with group
> read,write exe. Currently I do this via a script:
> chown nobody
> chgrp webdev
> chmod g+rwx
>
> What would be a better way to have the rights change via samba. Ideally
the
> rights should be inherited from the rights of the folder. At least this
is
> what I think.

You can inherit file ownership (both uid and gid) by using the setuid
and setgid bits on the parent directory:

        chown -R nobody.webdev /share
        chmod ug+s /share

Note the new permissions on the folder (assuming 755 beforehand):

        drwsr-sr-x

Which means:

        drws - this directory is readable and writable by the owner,
              - all files created in this folder will inherit the owner's
uid
         r-s - this directory is readable by group members
              - all files created in this folder will inherit the same gid
         r-x - this directory is readable by others (everyone)
              - everyone can change directory into this folder

You might want to do the same for all child directories under that
directory as well:

        find /share -type d | xargs chmod ug+s

Enjoy!

- Ian



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 18:30:51 EDT