23

There's a specific user that I don't want to be able to access my home directory. How do I deny access to them, while still allowing access to others who would normally have it?

Rob John
  • 343
  • 1
  • 2
  • 5

1 Answers1

31

If you want to limit access to users outside of your group or any other user, the question is a duplicate of Restrict access to my home folder from another standard user account

Otherwise, if you want to restrict access to just one user, call it enemyuser, use ACL:

cd ~
setfacl -m u:enemyuser:000 .

...and just enemyuser will have the access to your home directory denied.

To check the effect:

[romano@pern:~] % chacl -l .
. [u::rwx,u:enemyuser:---,g::r-x,m::r-x,o::r-x] 

To remove the ACL, you just say:

setfacl -x u:enemyuser .

The *acl commands used here are from the package acl, which should be installed by default (at least, I think).

Rmano
  • 32,167