Table of Contents
Adding privileges to directory for non-root user
Problem description
Let’s imagine we want to give non-root user access to root directory.
Let it be /var/lib/docker/volumes/
.
The easiest approach is as follows:
Install acl
package
sudo apt install acl
With the commands from this package we may easily view and edit privileges to files/directories
Add privileges to /var/lib/docker/
By adding privileges only to /var/lib/docker/volumes
we wouldn’t
have access to it anyway because we would be blocked at
/var/lib/docker/
level, so we need to give access to this directory.
Note that we do not use -R
modifier because:
- we don’t want user has access to all that is inside
docker/
-
with
-R
evaluating this command may take very looooongcd /var/lib/ sudo setfacl -m u:USERNAME:rwx docker/
Add recursively privileges to /var/lib/docker/volumes
Now we do use -R
modifier:
sudo setfacl -R -m u:USERNAME:rwx volumes/
Now we can…
Inspect directory access control list
getfacl /var/lib/docker/volumes/
Links
https://delinea.com/blog/linux-privilege-escalation