Incompatible group permission - Is it a bug?



Hi,

I am creating another user and placing an existing user in the group
of other user, hoping to write in the home directory of other user.
Sounds very simple!

# uname -a
Linux vini 2.6.38-11-generic #50-Ubuntu SMP Mon Sep 12 21:18:14 UTC
2011 i686 athlon i386 GNU/Linux
# whoami
vivek
# su root
# useradd -m -U foo // create user foo
# usermod -a -G foo vivek // add user `vivek' to group `foo'
# chmod 770 /home/foo/
# exit
# whoami
vivek
# cd /home/foo/
bash: cd: /home/foo/: Permission denied
# groups vivek
vivek : vivek foo

This is totally weird. Though user `vivek' is in group `foo', and
group bits for /home/foo/ is set to rwx, `vivek' can't chdir to
/home/foo/. I am not able to understand this.

But, if at the `exit' step, I switch to `vivek' user from root, this
is what happens:

# uname -a
Linux vini 2.6.38-11-generic #50-Ubuntu SMP Mon Sep 12 21:18:14 UTC
2011 i686 athlon i386 GNU/Linux
# whoami
vivek
# su root
# useradd -m -U foo // create user foo
# usermod -a -G foo vivek // add user `vivek' to group `foo'
# chmod 770 /home/foo/
# su vivek
# whoami
vivek
# cd /home/foo/
# ls
examples.desktop

Now, whatever is happening here is totally incomprehensible. Does `su
vivek' inherits some permissions from the `root' user at this step?

Any explanations would be much appreciated.

Thanks,
Vivek


--
To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx
with a subject of "unsubscribe". Trouble? Contact listmaster@xxxxxxxxxxxxxxxx
Archive: http://lists.debian.org/CAENtUgpDtOmW8u6ooOvp3SP2unMPn-0E5GraKjOUMdxYkqbj0w@xxxxxxxxxxxxxx



Relevant Pages

  • Re: Root: none
    ... sm01@stt008:~$ whoami ... And if it is just setting the hostname you want: ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx ...
    (Debian-User)
  • Re: Root: none
    ... sm01@stt008:~$ whoami ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx ... Trouble? ...
    (Debian-User)
  • Re: crontab uid ?
    ... if you're not sure what user it's running as, try running "whoami" in ... although if it's root's crontab it should definitely be ... running as root. ... To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org ...
    (Debian-User)