Restrict student account permissions, give faculty access

chmodgrouppermissionsSecurityusers

I have set up two user groups, students and faculty on Ubuntu 12.04 and created a number of students and faculty accounts. The problem is a student can currently see & read all of the files of a fellow student :-/

I would like to prevent students from seeing/reading each others directories/files, but permit someone in the faculty group freely access to the student groups.

I'm not sure how to go about this, can anyone offer pointers on
how to implement this policy? I know how to set/change groups, but not
how to limit the policy to what they can do/see. (I've been a Linux
user for a while, but administering more than my own account is new to
me)

Also, would I have to change the umask for all student accounts to make sure this policy doesn't get circumvented with new files/directories students create subsequently?

Would I as root execute chmod go-rx /home/* on each student homedirectory to accomplish this goal, or am I going about this the wrong way?

UPDATE: Just to clarify, my goal is to have this as a default setup, I don't expect I can prevent informed/curious students from changing their own permissions – and I'm willing to live with that.

Best Answer

I think I would attempt to do this using ACLs as well. The only other method I can conceive of doing this would be as follows.

  1. Create 2 groups students & faculty
  2. Each user's home dir. would be like this:

    drwxrws---. 253 student1 faculty 32768 Nov 29 16:39 student1
    

    This would allow anyone in the faculty group access to student1's directory, but no one else, except the owner, student1.

  3. chown -R student1.faculty /home/student1

  4. find /home/student1 -type d -exec chmod ug+rwx,g+s,o-rwx {} +

The trouble with this approach is that it can be a bit fragile if the owner were to mess with the group ownership, or were to mv files into this directory. Only newly created files/directories would persist the ownerships + setgid bit.

This setup requires that all the preexisting files/directories under /home need to be adjusted using steps #3 and #4 above.

ACLs

As I said above, I think I would still do this using ACLs. I would consult this tutorial on ACLs, titled: Using ACLs with Fedora Core 2 (Linux Kernel 2.6.5). The title makes it sound dated but the commands are still relevant.

Related Question