Thanks guys for your quick and thorough replies. That was it, problem solved and now 
on to the next set of tasks.

------ original message ------
From: Trevor Lauder <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Sent: Wed May 28 00:14:14 MDT 2003
Subject: Re: (clug-talk) Forcing file and directory permissions

If you have a directory, say /test that looks like this:
<br>
<br>drwxrwx---    2 stork  stork          17 May 27 23:57 test
<br>
<br>You can do a SGID with 'chmod g+s test/' to force the group on new files
<br>and directories to be whatever the group of the directory is, in this
<br>example it would be stork.  So after that command it should look like
<br>this:
<br>
<br>drwxrws---    2 stork  stork          17 May 27 23:57 test
<br>
<br>Then as root, I could create a file in /test:
<br>
<br>touch /test/testfile
<br>
<br>And then create a directory:
<br>
<br>mkdir /test/testdir
<br>
<br>A 'ls -l /test/' would show:
<br>
<br>ls -l /test/
<br>
<br>total 0
<br>drwxr-sr-x    2 root     stork           6 May 28 00:11 testdir
<br>-rw-r--r--    1 root     stork           0 May 28 00:01 testfile
<br>
<br>The file is owned by the user root, however the group is set to stork
<br>instead of what it would have been otherwise.  The same is also true for
<br>the directory, however the new sub-directory also has the SGID bit set on
<br>it too, so files and directories created under it would also have the same
<br>effect.  If you also want to force permissions you can take a look at the
<br>'umask' man page.
<br>
<br>As far as I have been able to find out, there is no way to force the user
<br>in a similar manner (Someone please share this knowledge if there is a way
<br>:), however Samba does have that kind of functionality.  Not sure about
<br>NFS, haven't played with it enough too say.
<br>
<br>For Samba, you can use "force user = <user>" and "force group = <group>"
<br>under each share section to force which user/group is used to access the
<br>share after authentication occurs.  You may also want to check the man
<br>page for smb.conf and look at the following options, they may offer some
<br>more functionality that could prove useful:
<br>
<br>force create mode
<br>force directory mode
<br>force directory security mode
<br>force security mode
<br>
<br>Sorry I couldn't fully answer your question, I hope this helps though.
<br>
<br>Cheers,
<br>
<br>--
<br>Trevor Lauder
<br>Web: http://www.thelauders.net
<br>E-Mail: [EMAIL PROTECTED]
<br>Resume: http://www.thelauders.net/resume.html
<br>Gentoo Powered
<br>
<br>"Any intelligent fool can make things bigger and more complex... It takes
<br>a touch of genius -- and a lot of courage to move in the opposite
<br>direction."  -- Albert Einstein
<br>
<br>Johnny Stork said:
<br>> I am trying to re-configure much of my network and cant recall, or now
<br>> find, how to force a directory to use a specific user.group when new files
<br>> or sub-directories are created, even when logged in as root or another
<br>> user. For instance, if I have the following
<br>>
<br>> /home/stork   (currently chown -R stork.stork)
<br>> /home/german (currently chown -R german.german)
<br>>
<br>> I would like to ensure that no matter who I am logged in as (root, stork,
<br>> german), that all new files and directories get created with the same
<br>> user.group as set above. Obviously only root having access to both, but
<br>> when files or directories are created in either, the new object is created
<br>> with the user.group set above.
<br>>
<br>> Also, since these home locations are also exported via NFS and shared via
<br>> Samba, I want the same behavior whether I am connecting from a Windows or
<br>> Linux machine.
<br>>
<br>>
<br>>
<br>> <hr>
<br>> <b><font color=blue size=4>Open Enterprise Solutions</font>
<br>> <font color=red>Linux & Open Source Solutions for Business</font></b>
<br>>
<br>> Johnny Stork, B.A.
<br>> Calgary, AB
<br>>
<br>> <a href="http://www.openenterprise.ca";>
<br>> www.openenterprise.ca</a>
<br>>
<br>>
<br>
<br>
<br>

Reply via email to