Linux permissions

topic: Linux
related: Linux users

Permission layers

options

  1. change ownership of the dir to that user
  2. add user to the group that owns the directory or change the group ownership of the dir
  3. use ACL.

How to grant user to have access to folders without granting shared folders.

# set permission for old files recursively
sudo setfacl -R -m u:username:rwx /opt/docker
# set permission for new files
sudo setfacl -R -d -m u:username:rwx /opt/docker

getfacl /opt/docker

This allows user username to have rwx access to the /opt/docker for any existing files recursively, and also to have default permission for any new files created there.

# remove acl entry for user username
sudo setfacl -x u:username /opt/docker
# remove default acl
sudo setfacl -k /opt/docker
# wipe all acl, restore to unix permissions
sudo setfacl -b /opt/docker