[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

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


Reply to: