[K12OSN] Dropbox question

Jim Kronebusch jim at winonacotter.org
Wed Dec 20 14:27:48 UTC 2006


> While it works for dropping the files to the folder, how do I ensure 
> that the ownership of the files is set to the owner of the directory,
>  and/or that the permissions are set so that the owner of the 
> directory can then read the files?  

Here at our school we have a drop folder for each teacher, then one for each
class period they have underneath it.  So folder /home/Drop may look like this:

/home/Drop/Teacher1/period1
/home/Drop/Teacher1/period3
/home/Drop/Teacher1/period4
/home/Drop/Teacher2/period2
/home/Drop/Teacher2/period5
/home/Drop/Teacher3/period6
/home/Drop/Teacher4

You get the idea.  Anyhow I set /home/Drop/TeacherX readable by everyone. 
That way all users can navigate to any teachers folder and class.  The
directory /home/Drop is owned by root.staff and permissions are 755.  The
individual teacher folders are owned by teacherx.teacherx and permissions are
775.  The actual drop folder of periodx is owned by teacherx.teacherx and
permissions are 773.  

But you still have the problem that when a student drops in his/her homework,
it is owned by the student which can affect quotas and how the teacher works
with the dropped homework.  So my fix (thanks to this list) was to have a
script run every minute via cron that looks like this:

#!/bin/bash
for file in /home/Drop/*
do owner=$(ls -ld \
"$file"\
|awk '{print $3}')
chown -R $owner \
"$file"
done

What this does is basically reassign privileges based on the enclosing folders
permissions.  So every minute every file under the /home/Drop/TeacherX folders
gets reassigned permissions to be owned by the same user that owns
/home/Drop/TeacherX.  It has worked great now for us for 3 years.  This same
script works no matter what the directory structure looks like under
/home/Drop/TeacherX.  We have some teachers that want 6 drop folders, and some
that want users to simply drop on TeacherX.  If they do not want sub folders
then you just have to set permissions to /home/Drop/TeacherX to 773.

Hope that helps,
Jim K


-- 
This message has been scanned for viruses and
dangerous content by the Cotter Technology 
Department, and is believed to be clean.




More information about the K12OSN mailing list