Skip to content

Instantly share code, notes, and snippets.

@gipert
Last active June 8, 2019 10:34
Show Gist options
  • Save gipert/f7f5f8476681739f955acbe5448ea146 to your computer and use it in GitHub Desktop.
Save gipert/f7f5f8476681739f955acbe5448ea146 to your computer and use it in GitHub Desktop.
Set-up shared folders
#!/bin/bash
# first assign to your directory the permissions/ownership you want
chgrp -R gerda $1
chmod -R ug+rwX,o-rwx $1
# the sticky bit is needed to preserve the group ownership
chmod g+s `find $1 -type d`
# the others won't be able to see anything...
setfacl -R -d -m o::- $1
# ...but the group will
setfacl -R -d -m g::rwX $1
echo 'Done!'
#!/bin/bash
# first edit existing permissions
setfacl -R -m u:user1:rwX u:user2:rwX [...] $1
# then set the default ones
setfacl -d -R -m u:user1:rwX u:user2:rwX [...] $1
echo 'Done!'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment