2

I have a Centos 7 server with 80 users and I have lots of directories that all 80 users can access. However I want one specific user to not be able to access one single directory, how can I do that?

I only want to block one user from acessing a specific directory, keep all the other users privileges unchanged. How can I do that?

1
  • 2
    I see that you kindly called other people here "idiots" for voting to put your previous questions on hold. The reason they were put on hold is that they lacked the concrete information you included in this version of the question. In the future, you should know that you can edit a question when it's on hold. This will place it in a review queue for being reopened. That way you will not need to ask multiple questions to get it right; you can fix the one that's on hold instead. Also, please don't be rude to the other members of the site. Calling people idiots is rude. Don't do that.
    – Jenny D
    Sep 14, 2016 at 15:45

2 Answers 2

1

Use Access Control List

To block the user 'user_to_block':

setfacl -m u:user_to_block:000 <path_to_directory_you_want_to_block_access>

m-> Modify file system

u -> user (this can also be a 'g' for group ACLs)

:000 -> Permissions in Linux filesystem (alternatively can be an octal digit from 0 to 7 or letters - read (r), write (w), execute (x))

You can check ACL with the command:

getfacl <file_or_dir_you_want_to_check_ACLS>

To remove ACL for one user/group(e.g., user 'user_to_block'):

setfacl  -x  u:user_to_block <file_or_directory>

To remove entire ACL (all groups and users already set ACLs):

setfacl –b <file_or_directory>

References

Another options and information can be found in man pages for setfacl command:

man setfacl

Online Resource: http://linux.die.net/man/1/getfacl

2
  • 1
    WOWWW THAT WORKED!!!! Thank you so much!!!!!! I asked this question 3 other times in ServerFault and some idiots removed my question twice. At least now someone smart could solve this!
    – Samul
    Sep 14, 2016 at 15:21
  • 1
    You're welcome! Upvote if you liked this answer! ACLs are powerfull tools! Sep 14, 2016 at 15:28
0

Assuming that all users are accessing the directories on the command line and not e.g. via samba, "man setfacl" might help you, I guess.

1
  • AFAIK Samba will also honour ACL's
    – HBruijn
    Sep 14, 2016 at 21:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .