LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (http://www.linuxquestions.org/questions/linux-server-73/)
-   -   Samba folder containing subfolders with specific rights (http://www.linuxquestions.org/questions/linux-server-73/samba-folder-containing-subfolders-with-specific-rights-730840/)

StarQuake64 06-05-2009 03:40 AM

Samba folder containing subfolders with specific rights
 
Lately I'm getting this question a lot.
For every project I want to create a tree like this:
Code:

- project
  - drawing
  - secretariat
  - coordination

Everyone should be able to read/write in 'project'.
Only drawing should be able to read/write in 'drawing'.
Only secretariat should be able to read/write in 'secretariat'.
And so on...

I think I can manage to set this up in samba. The problem is, is there a way to enforce those rights when a new project is created from a windows client?

suhas! 06-05-2009 04:32 AM

Quote:

Originally Posted by StarQuake64 (Post 3563816)
Lately I'm getting this question a lot.
For every project I want to create a tree like this:
Code:

- project
  - drawing
  - secretariat
  - coordination

Everyone should be able to read/write in 'project'.
Only drawing should be able to read/write in 'drawing'.
Only secretariat should be able to read/write in 'secretariat'.
And so on...

I think I can manage to set this up in samba. The problem is, is there a way to enforce those rights when a new project is created from a windows client?

Well, how would samba server know which group should have permissions over new project (folder) created from Windows Client machine? The new project would get read/write permission for everyone, i.e. inherited from parent folder project. Can you explain more about your query?

PS: you may want to look at swat... a gui based samba administration tool which you can use to manage samba server from client machine

ddaemonunics 06-05-2009 05:02 AM

You can create in advance every folder for every project ...or ...this is what I've done...I've created a web interface on the samba server..and when someone wanted to create a new project...he would access the web interface and create the folder structure from there.The web interface allowed the users to manage projects...create/delete, add information about them.

ABL 06-05-2009 12:29 PM

A script??
 
Isn't this a problem just crying out for a script?

You could write a script that would take an input of a name (say, $project), and create the directory structure in the appropriate location. It seems like it would be pretty straightforward:
#!/bin/bash
mkdir /home/$project
mkdir /home/$project/drawing
mkdir /home/$project/secretariat
mkdir /home/$project/coordination
chmod 777 /home/$project
chmod 770 /home/$project/drawing
chown drawing:drawing /home/$project/drawing
...

Make the script executable by whoever is allowed to set up projects, and make sure it's accessible.

Throw in some error checking, test it, and voila! Or am I missing something?

StarQuake64 06-05-2009 01:05 PM

Thanks!
 
Thanks! All 3 replies are pretty useful.

Now looking if there is a way to automatically trigger the script. But running it from a webpage will do for now.


All times are GMT -5. The time now is 06:01 PM.