Once again, I learn a lot just reading posts to this list. I might add I found out some more basic info on this topic at <a href="http://en.wikipedia.org/wiki/Umask">http://en.wikipedia.org/wiki/Umask</a>. <br><br><div><span class="gmail_quote">
On 4/18/07, <b class="gmail_sendername">Gavin McCullagh</b> &lt;<a href="mailto:gmccullagh@gmail.com">gmccullagh@gmail.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br><br>On Tue, 17 Apr 2007, Ian Moore wrote:<br><br>&gt; File access permissions. Basically we have about 5 machines which users<br>&gt; log onto with using a location specific user account.<br><br>It&#39;s up to you but I try to avoid location-specific accounts like the
<br>plague.&nbsp;&nbsp;It keeps people in that tortured &quot;file X is on computer Y only&quot;<br>mentality.&nbsp;&nbsp;If they are given their own accounts they can have their own<br>files and settings whichever computer they sit down at.&nbsp;&nbsp;I&#39;m sure you have
<br>your reasons of course, but if at all possible, I&#39;d give people individual<br>accounts.&nbsp;&nbsp;However, that doesn&#39;t solve this problem:<br><br>&gt; As people often work on the same documents and files but at different
<br>&gt; times and from different workstations we saved most things to a shared<br>&gt; directory called &#39;public&#39;.<br><br>First an executive summary:<br><br> - make sure all involved users are in some group<br> - use chgrp to set the group of the shared directory
<br> - use chmod to set the setgid bit and give write access to the group on<br>&nbsp;&nbsp; your shared directory.<br> - set everyone&#39;s default umask to 0002 in /etc/profile<br><br>Now an explanation:<br><br>There&#39;s probably two things you need to look at.&nbsp;&nbsp;One is which group files
<br>are created with by default (setgid on directory) and the other is the<br>permissions files are created with (umask).&nbsp;&nbsp;What I presume you want is a<br>situation like this:<br><br>gavinmc@boing:~$ ls -la /shared/<br>total 8
<br>drwxrwsr-x&nbsp;&nbsp;2 root&nbsp;&nbsp;&nbsp;&nbsp;admin 4096 2007-04-18 09:09 .<br>drwxr-xr-x 21 root&nbsp;&nbsp;&nbsp;&nbsp;root&nbsp;&nbsp;4096 2007-04-18 09:03 ..<br>-rw-rw-r--&nbsp;&nbsp;1 gavinmc admin&nbsp;&nbsp;&nbsp;&nbsp;0 2007-04-18 09:03 somefile<br><br>So /shared is owned by &quot;root&quot;, with the group &quot;admin&quot; and somefile has been
<br>created by gavinmc allowing members of the group &quot;admin&quot; write access.&nbsp;&nbsp;The<br>group &quot;admin&quot; has write access so all of those users can create files in<br>/shared.&nbsp;&nbsp;Also, the setgid bit is set on /shared which means that new files
<br>created in that folder will automatically have the admin group associated.<br><br>This is done with<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sudo mkdir /shared<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sudo chgrp admin /shared<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sudo chmod g+w /shared<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sudo chmod g+s /shared
<br><br>Now, the next thing is, when a user &quot;sarah&quot; creates a file, the group must<br>have write access to the file.&nbsp;&nbsp;As Denis says, umask is what you want here.<br>Every user session has a &quot;umask&quot; which dictates what permissions are given
<br>to files they create.&nbsp;&nbsp;The norm is 022, meaning those in the file&#39;s group<br>and others get read access but not write access.&nbsp;&nbsp;Below I create a file<br>somefile3, then change my umask and create another.&nbsp;&nbsp;Note in the second
<br>case that the group &quot;admin&quot; gets write access.<br><br>gavinmc@boing:~$ umask<br>0022<br>gavinmc@boing:~$ touch /shared/somefile3<br>gavinmc@boing:~$ ls -la /shared/somefile3<br>-rw-r--r-- 1 gavinmc admin 0 2007-04-18 09:17 /shared/somefile3
<br>gavinmc@boing:~$ umask 0002<br>gavinmc@boing:~$ touch /shared/somefile4<br>gavinmc@boing:~$ ls -la /shared/somefile4<br>-rw-rw-r-- 1 gavinmc admin 0 2007-04-18 09:18 /shared/somefile4<br><br>If you look at the last lines of /etc/profile, the umask for all users gets
<br>set there.&nbsp;&nbsp;Edit the file and change the umask command from 0022 to 0002.<br>Then logout and log back in again.&nbsp;&nbsp;At a shell, type umask to make sure you<br>get 0002.&nbsp;&nbsp;Then create a file and you should see group write permissions on
<br>the new files you create.<br><br>As /etc/profile sets everyones umask, the same should now be true for<br>everyone else.<br><br>&gt; The partial solution we found was to connect to this public directory<br>&gt; using a samba share, shortcut link located on the desktop. This was
<br>&gt; already setup anyway for our Window machine on the network.<br><br>This is due to the way samba maps unix to windows file permissions.&nbsp;&nbsp;There<br>is a &quot;create mask&quot; setting in smb.conf which you can modify similarly to
<br>linux umask which sets the permissions created when files are created over<br>a samba share.<br><br>One final warning.&nbsp;&nbsp;You should explain to people that they must be careful<br>two people do not edit files at the same time.&nbsp;&nbsp;Linux itself (unlike
<br>windows) doesn&#39;t usually enforce file locking.&nbsp;&nbsp;This can be good and bad,<br>depending on the situation.<br><br>Gavin<br><br><br>--<br>edubuntu-users mailing list<br><a href="mailto:edubuntu-users@lists.ubuntu.com">
edubuntu-users@lists.ubuntu.com</a><br>Modify settings or unsubscribe at: <a href="https://lists.ubuntu.com/mailman/listinfo/edubuntu-users">https://lists.ubuntu.com/mailman/listinfo/edubuntu-users</a><br></blockquote></div>
<br>