Take the 2-minute tour ×

I have a weird bug, I have:

  • a user A
  • a group B
  • another group C

I create a folder and then chown it A:B and chmod it 750.

After usermod -aG A C, C should have the right to go to the newly created folder, right? But it does not work all, I get a permission denied error.

Any hints?

share|improve this question

3 Answers 3

The only people allowed to access the folder are:

user A: He is the owner
members of B: They can read/browse the folder

And that's it. The 0 in 750 means that other users won't be allowed to do anything with this folder. What you did was to add user A to the group C, but it doesn't affect the folder at all.

share|improve this answer
The OP usermod command would add a user C to group A, which doesn't match the explanation of the problem –  mtm Jan 29 '13 at 12:06

The synopsis for usermod from the man page is usermod [options] LOGIN. Your command has the group last instead of the login last.

The group is an argument to the -G option. It helps a little to separate options that require arguments from those that don't:

usermod -a -G C A

As @Rosco said, however, this still won't give A access to the directory. You will either need to add A to the B group or change the group of the directory to C.

share|improve this answer
usermod -aG A C

Adds user C to group A, however you haven't mentioned a group A.

Even if you did have a group A, the permissions on the folder are for user A, and group B, so membership to group A would not help.

To access the folder, you need to be either user A, or a member of group B. So running:

usermod -aG B C

Would allow user C to access the folder as a member of group B.

share|improve this answer

Your Answer

