Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

in linux,

if a user belongs to 2 groups. 1 group gives the user access to a file (say read) the other group doesn't allow them access.

Is there a way to deny access to a file EVEN if a group the user belongs to is giving him read access?

share|improve this question

The normal way to do this would be to create two groups, one which said user is a member of, and one which that user isn't, and assign the groups accordingly.

share|improve this answer

Last I knew this wasn't possible.

If the user shouldn't have access, then the user shouldn't belong to that group / role or the group / role shouldn't have access.

share|improve this answer

File permissions have only one group-id field. Which means the file can be accessed if the user belongs to that group. Other belongings do not affect it.

share|improve this answer

This isn't possible with built-in Linux permissions.

POSIX ACL, on Linux, doesn't allow this either.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.