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> <<a href="mailto:gmccullagh@gmail.com">gmccullagh@gmail.com</a>> 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>> File access permissions. Basically we have about 5 machines which users<br>> log onto with using a location specific user account.<br><br>It's up to you but I try to avoid location-specific accounts like the
<br>plague. It keeps people in that tortured "file X is on computer Y only"<br>mentality. If they are given their own accounts they can have their own<br>files and settings whichever computer they sit down at. I'm sure you have
<br>your reasons of course, but if at all possible, I'd give people individual<br>accounts. However, that doesn't solve this problem:<br><br>> As people often work on the same documents and files but at different
<br>> times and from different workstations we saved most things to a shared<br>> directory called 'public'.<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> your shared directory.<br> - set everyone's default umask to 0002 in /etc/profile<br><br>Now an explanation:<br><br>There's probably two things you need to look at. 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). What I presume you want is a<br>situation like this:<br><br>gavinmc@boing:~$ ls -la /shared/<br>total 8
<br>drwxrwsr-x 2 root admin 4096 2007-04-18 09:09 .<br>drwxr-xr-x 21 root root 4096 2007-04-18 09:03 ..<br>-rw-rw-r-- 1 gavinmc admin 0 2007-04-18 09:03 somefile<br><br>So /shared is owned by "root", with the group "admin" and somefile has been
<br>created by gavinmc allowing members of the group "admin" write access. The<br>group "admin" has write access so all of those users can create files in<br>/shared. 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> sudo mkdir /shared<br> sudo chgrp admin /shared<br> sudo chmod g+w /shared<br> sudo chmod g+s /shared
<br><br>Now, the next thing is, when a user "sarah" creates a file, the group must<br>have write access to the file. As Denis says, umask is what you want here.<br>Every user session has a "umask" which dictates what permissions are given
<br>to files they create. The norm is 022, meaning those in the file's group<br>and others get read access but not write access. Below I create a file<br>somefile3, then change my umask and create another. Note in the second
<br>case that the group "admin" 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. Edit the file and change the umask command from 0022 to 0002.<br>Then logout and log back in again. At a shell, type umask to make sure you<br>get 0002. 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>> The partial solution we found was to connect to this public directory<br>> using a samba share, shortcut link located on the desktop. This was
<br>> 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. There<br>is a "create mask" 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. You should explain to people that they must be careful<br>two people do not edit files at the same time. Linux itself (unlike
<br>windows) doesn't usually enforce file locking. 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>