User File Dropbox Permissions

shalford
New Contributor

I am having an issue with a dropbox share point that is hosted on our Mac Server. This folder is used for our students to submit completed projects to their teacher.

We are using Server 4.1 and I am modifying the user permissions using the GUI. I want our users to be able to create a folder on the desktop of their Mac and have the ability to drag the folder into the share. I would also like the user to have the ability to rename their own folder but NOT be able to modify/Delete any other users folders with in this dropbox share. Our users are using AD accounts to authenticate to the share and using the SMB protocol.

Currently the users can create a folder within the share point and rename it when the folder is first created. Once the rename option disappears the user cannot rename the folder. The user cannot drop folders into the dropbox share point if they are created on their local machine.

Can anyone help me get this done using command line?

2 REPLIES 2

davidacland
Honored Contributor II
Honored Contributor II

I have had issues trying to do this with SMB. Have you tested it with AFP? You might find it works a lot better.

techhelprhs
New Contributor III

Here is a script that I use to create faculty dropboxes. We create shares and give the dropbox groups read only permissions to the top level. We then create a tab delimited txt file containing the teachers at the specific school: The txt file contains usernames in the first column and folder names in the second (we wanted a different naming convention for the folders).

The script is setup to ask for folder and file locations from within terminal (this way you can cheat and drag the folder and file into the terminal window) . Save the code below as yourfilename.sh and sudo chmod u+x /path/to/yourfilename.sh in order to make it executable. You should be able to open it with terminal. What it should do is create the folder structure, setup specific acl and posix permissions for specific directories (inherited acls allow the teachers to manipulate the students' dropped folders), and change the ownership accordingly.

Quick notes:
Copy the txt file into the folder where you are creating dropboxes first.

I chose the 550 posix permissions because I don't want teachers to try to create their own folders. YMMV.
I would definitely recommend testing this with a VERY small group of users and modify folder names, etc. according to your environment.

The txt file looks like this:

teacher_01 TEACHER_01_FOLDER
teacher_02 TEACHER_01_FOLDER
end end

Hope it helps,

-Chris

#!/bin/bash

###Set ACL Permissions
ACL="allow read,write,execute,delete,append,list,search,add_file,add_subdirectory,delete_child,readattr,writeattr,readextattr,writeextattr,readsecurity,writesecurity,chown,inherited,file_inherit,directory_inherit"

# Make sure only root can run our script
if [ "$(id -u)" != "0" ]; then
   echo "This script must be run as root" 1>&2
   exit 1
fi
# ...

### User Input
echo "Hello, "$USER".  This script will create properly formatted Dropbox folders in the specified path."
echo "Where do you want to create the folders? Enter the FULL path and Press [ENTER]:"
read PATH
echo "Where are the usernames located? Enter the FULL path and Press [ENTER]:"
read FOLDERS

cd $PATH
/bin/cat $FOLDERS | while read USERNAME FOLDERNAME; do 
/bin/mkdir -p $FOLDERNAME/Period_{1..9}/{DropBox,Pickup}
/bin/chmod -R +a "$USERNAME:$ACL" $FOLDERNAME/Period_{1..9}
/bin/chmod 733 $FOLDERNAME/Period_{1..9}/DropBox
/bin/chmod 550 $FOLDERNAME
/usr/sbin/chown -R $USERNAME $FOLDERNAME
done
exit 0