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?
-
2possible duplicate of Restrict acces to my home folder from another standard user account– user68186Apr 14, 2015 at 14:23
-
2IMO the best way is with encryption - help.ubuntu.com/community/EncryptedPrivateDirectory. If you want to have a finer grain of control you need to use ACL - help.ubuntu.com/community/FilePermissionsACLs and– PantherApr 14, 2015 at 14:30
-
4@user68186 (and others) It may not be a duplicate as Rob may want to restrict only one user and not all users.– PantherApr 14, 2015 at 14:31
-
1Thanks @bodhi.zazen for pointing this out. I will retract my close vote, but keep the link in comment, in case someone is looking for a more general solution.– user68186Apr 14, 2015 at 14:34
-
2Please remove the close votes --- the question is NOT a duplicate; OP was asking to restricting access to just one user, which is not solved in the proposed duplicate.– RmanoApr 15, 2015 at 8:16
1 Answer
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).
-
Thanks a lot. Exacly what I wanted. In case I change my mind and I need to allow enemyuser access, what do I need to do?– Rob JohnApr 14, 2015 at 15:53
-
4
-
On my system, the command
lsacl
does not exist. Where did you get it? Apr 21, 2015 at 11:25 -
@PaddyLandau oops, it's a script I got from internet some time ago that pretty-prints long ACL lists. I changed the answer using standard tools. Here: lists.gnu.org/archive/html/coreutils/2014-10/msg00031.html– RmanoApr 21, 2015 at 12:40