Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved] Shared directory between users with static perm.
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
corec
n00b
n00b


Joined: 25 Oct 2007
Posts: 8

PostPosted: Tue Jul 22, 2008 8:00 am    Post subject: [Solved] Shared directory between users with static perm. Reply with quote

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:


  1. 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.

  2. 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
View user's profile Send private message
aceFruchtsaft
Guru
Guru


Joined: 16 May 2004
Posts: 438
Location: Vienna, Austria

PostPosted: Tue Jul 22, 2008 9:09 am    Post subject: Re: Shared directory between local users with static permiss Reply with quote

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
View user's profile Send private message
corec
n00b
n00b


Joined: 25 Oct 2007
Posts: 8

PostPosted: Tue Jul 22, 2008 9:28 am    Post subject: Re: Shared directory between local users with static permiss Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
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