You can use ACL
and the command setfacl
for that.
ACL Entries
ACL entries consist of a user (u), group (g), other (o) and an effective rights mask (m). An effective rights mask defines the most restrictive level of permissions. setfacl
sets the permissions for a given file or directory. getfacl
shows the permissions for a given file or directory.
Defaults for a given object can be defined.
ACLs can be applied to users or groups but it is easier to manage groups. Groups scale better than continuously adding or subtracting users.
This is the part you are after:
Copying an ACL into the Default ACL
Once the ACLs are the way they need to be, they can be set as the default. Defaults are inherited, so a new directory will inherit the defaults of the parent directory.
getfacl -a /path/to/dir | setfacl -d -M- /path/to/dir
You do need to add the acl
option when mounting. In /etc/fstab
add acl
to the options for your disc. Make sure to use a LABEL and not a UUID.
LABEL="ExternalUsbDisc" /media/usb-disc ext4 defaults,acl 0 2