I have one directory that I would like to prevent access for specific user. For example /home/myuser/secret
should not be readable, accessible etc to specific user. He can see that directoty exists, but can't access / read its contents or modify any way.
How can I do that?
If the filesystem supports ACLs, you can do this:
setfacl -m "u:dude:---" /home/myuser/secret
Which says the user dude
should have no access (neither r
nor w
nor x
) to that directory.
To verify, run the getfacl
command:
$ getfacl /home/myuser/secret # file: home/myuser/secret # owner: myuser # group: myuser user::rwx user:dude:--- group::rwx mask::rwx other::r-x