View previous topic :: View next topic |
Author |
Message |
corec n00b
Joined: 25 Oct 2007 Posts: 8
|
Posted: Tue Jul 22, 2008 8:00 am Post subject: [Solved] Shared directory between users with static perm. |
|
|
Hi all,
I'm trying to make a shared directory that all users could access with read/write permissions. I've used SETGID flag to preserve the group-id. Problem is that if some program writes a file to shared folder without setting write-flag for the group-id, nobody else in the group can modify the file.
Here are the specs of the directory:
drwxrws--- root users /home/Shared
Ideal solution to this would be that every time somebody creates or modifies a file or directory, permissions are adjusted immediately.
I've already made little research but not found any clear solution:
- Make a bash script to alter permissions and put it to cron so that it would be executed every hour or so. Drawback of this approach is that the file permissions are checked in timed intervals.
- While I was inspecting the possibility of using mount --bind (which can't use -o to set gid perm. with --bind btw) I found bindfs (http://code.google.com/p/bindfs/). bindfs is a FUSE filesystem for mirroring a directory to another directory, similarly to mount --bind. The permissions of the mirrored directory can be altered in various ways. With bindfs I could alter group permissions on the fly. Drawback of this is that I should have the shared folder in somewhere else to be able to mount it to /home/Shared. Also I didn't find an ebuild for bindfs anywhere.
From the solutions the latter one is definitely the better one though I'm little bit cautious when it comes to using a fuse system. I wouldn't want it to corrupt my files.
Do you guys have any suggestions to this?
Cheers,
corec
Last edited by corec on Tue Jul 22, 2008 9:29 am; edited 1 time in total |
|
Back to top |
|
|
aceFruchtsaft Guru
Joined: 16 May 2004 Posts: 438 Location: Vienna, Austria
|
Posted: Tue Jul 22, 2008 9:09 am Post subject: Re: Shared directory between local users with static permiss |
|
|
corec wrote: |
Do you guys have any suggestions to this? |
Yes. If you use ext3, reiserfs or xfs and your system supports POSIX ACLs (which any modern Linux distribution should), use those. For example, with
Code: |
setfacl -m "default:group:foo:rw" bar
|
you create a default ACL thereby automatically granting read/write access to group foo on any files/directories created in bar. No need to use scripts or FUSE.
If you have reiserfs or ext3, you will need to enable ACLs in fstab with the acl options. They are enabled by default on xfs.
HTH. |
|
Back to top |
|
|
corec n00b
Joined: 25 Oct 2007 Posts: 8
|
Posted: Tue Jul 22, 2008 9:28 am Post subject: Re: Shared directory between local users with static permiss |
|
|
aceFruchtsaft wrote: | corec wrote: |
Do you guys have any suggestions to this? |
Yes. If you use ext3, reiserfs or xfs and your system supports POSIX ACLs (which any modern Linux distribution should), use those. For example, with
Code: |
setfacl -m "default:group:foo:rw" bar
|
you create a default ACL thereby automatically granting read/write access to group foo on any files/directories created in bar. No need to use scripts or FUSE.
If you have reiserfs or ext3, you will need to enable ACLs in fstab with the acl options. They are enabled by default on xfs.
HTH. |
I wasn't even aware of the ACL. I use ext3 and your suggestion was just what I needed. Thanks!. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|