I have a /data folder (actually a partition) for all data that should be accessible by all users (in this case family members). We all have individual user accounts and are often all logged in at any time on this one PC.
How can I set up permissions so that we all retain access to files there no matter who creates them, including new folders? If I create a folder it gets my user and group, so nobody else can write to it.
Best Answer
Another approach is to use Access Control Lists, a superset of file permissions.
First of all, we have to install the acl
package:
Before Ubuntu 14.04, the partition has to be mounted with the option
acl
for the following to work. It could be added in/etc/fstab
, as inor for an already mounted filesystem
Next, you should create a new group, to which all users allowed to access the share in read/write mode will be added. I call it
usershare
. An already existing group could be used.Now we add the users
enzotib
andsteevc
to that group:(effective at the next login).
Then we add an ACL with
rwx
permissions for the groupusershare
to all files already in/media/shared
Finally we add a default ACL with
rwx
permissions for the groupusershare
for all files created from now on inside/media/shared
Now all users of the
usershare
group have full permissions on all files under/media/shared
. Permissions of each user on his and other's home directories are not affected.I tested this solution and seems to work, but suggestions and corrections are welcome.
Remark: new files and directories created in the considered directory will have write permission for the
usershare
group, but files copied or moved in the folder will retain their original permissions. If the user, as I understand, only require write access to newly created directories, this is not a problem. Otherwise it should modify permissions by hand. See this answer on how to overcome this by defining the umask of users to002
.