Group permissions seem inconsistent

Asked by Thinboy00

The group permissions seem a little strange... have a look at what I did:
1. created a new group called "test" and added myself to it.
2. created a subdirectory in my home directory and opened the home dir. as root
3. changed the permissions of the directory so that:
* root is the owner and has full permissions (meaningless because root can do anything regardless)
* "others" permission set to none
* the group is set to my user group (name identical to my uname) and has the same permissions as root (create & delete files)
Under those conditions, the directory opens right up.
4. changed the permissions so that the group is set to "test" (recall that I am a member of "test")
Now, the directory will not open at all
Why have different groups with identical member rosters behave asymmetrically? I assume this either is not a bug and simply me not understanding something, or is an egregious bug in the Linux kernel. I trust Linus's understanding of computer science a whole lot farther than I trust my knowledge of Linux. So what's up?

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Zach
Solved:
Last query:
Last reply:
Revision history for this message
Zach (zachary-burke) said :
#1

You are probably being bitten by the lack of eXecute permission. My guess is that if you do an ls -l in your home directory is that your permissions will look like:
drwxrw----

Unless you have eXecute permission, you cannot enter the directory.

An example from my system:
me@here:~$ ls -ld test
drw------- 2 me me 4096 2008-05-20 22:08 test
me@here:~$ cd test
-bash: cd: test: Permission denied
me@here:~$ chmod 700 test
me@here:~$ ls -ld test
drwx------ 2 me me 4096 2008-05-20 22:08 test
me@here:~$ cd test

Changing owner to root and leaving group to me
me@here:~$ ls -ld test
drwx------ 2 root me 4096 2008-05-20 22:08 test
me@here:~$ cd test
-bash: cd: test: Permission denied
me@here:~$ sudo chmod 760 test
me@here:~$ ls -ld test
drwxrw---- 2 root me 4096 2008-05-20 22:08 test
me@here:~$ cd test
-bash: cd: test: Permission denied
me@here:~$ sudo chmod 770 test
me@here:~$ ls -ld test
drwxrwx--- 2 root me 4096 2008-05-20 22:08 test
me@here:~$ cd test
me@here:~/test$

Revision history for this message
Thinboy00 (thinboy00) said :
#2

Yes, that works. What doesn't work is if you make a test group, put yourself in it (i.e. make yourself a member of it) and set the execute permission. In other words, suppose I am a member of a group named "testg":
~$ ls -ld test
drwxrwx--- 2 root testg 4096 2008-05-20 19:16 test
~$ cd test
bash: cd: test: Permission denied
But if the group is set to me, it works. Why can't I open the file if the group is set to a group of which I am a member?

Revision history for this message
Best Zach (zachary-burke) said :
#3

This should also work and works for me. Can you run the 'groups' command to verify that you see yourself as a member of group testg, you may have to re-login after adding yourself to the group:

###added myself to group 'testg'
me@here:~$ groups
me adm dialout cdrom floppy audio dip video plugdev scanner netdev lpadmin powerdev admin mythtv sambashare testg
me@here:~$ ls -ald test
drwxrwx--- 2 root me 4096 2008-05-20 22:08 test

###change group of test to testg
me@here:~$ sudo chgrp testg test
me@here:~$ ls -ld test
drwxrwx--- 2 root testg 4096 2008-05-20 22:08 test
me@here:~$ cd test
me@here:~/test$

Revision history for this message
Thinboy00 (thinboy00) said :
#4

Thanks Zach, that solved my question.

Revision history for this message
Zach (zachary-burke) said :
#5

Yay! The world was about to fall apart if that didn't work :/