Reputation: 21168
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?
Upvotes: 0
Views: 474
Reputation: 10271
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
Upvotes: 1
Reputation: 29942
If you want to let other user navigate an arbitrary /home/ dir of another user, but you want to deny others to do that, you can procede as follows
chmod 750 /home/myuser/secret
groupadd secret_users
chown -R :secret_users /home/myuser/secret
/etc/group
file. user inserted here could read files inside that folder but other users can'tUpvotes: 0
Reputation: 46
Hello Linux Permissions are set as "Whitelist". You try to specify a blacklist.
I'w create a group with all user who should have access.
Upvotes: 0