Click to See Complete Forum and Search --> : Simple newbie question about groups


Algemon
01-12-2001, 06:54 PM
I don't understand what I am doing wrong here.

If I make a file as root using vi called /root/test.test, and chmod it so that it read and writable by root and readable by group (# chown o-rw test.test).
Then I created a new group called peck (# groupadd peck).
Then I added user algemon to the group peck (# gpasswd -a algemon peck).
Then as algemon, I listed the file as follows: $ ls -al /root/test.test
-rw-r----- 1 root peck 22 Jan 13 18:33 /root/test.test
Then if I try and cat the file it won't let me as user algemon: $ cat /root/test.test
cat: /root/test.test: Permission denied

I just don't understand that, algemon belongs to the group peck as I checked in /etc/group (# cat /etc/group) shows:
peck:x:1001:algemon

If on the other hand I chown the test.test file to group algemon then user algemon can cat the file.

Why is that?

I am running Debian 2.2 Potato if that is important.

[This message has been edited by Algemon (edited 12 January 2001).]

Algemon
01-12-2001, 07:16 PM
I just realised that it must be something different with debian. When I try the same thing on my RedHat system then it works.
File lists (ls -al) as follows:
-rw-r----- 1 root peck 22 Jan 13 09:13 test.test
And $ cat test.test (as user algemon on RedHat) works and shows the contents of the file.

What is this difference between RedHat and Debian.

How do I allow users to have group permissions under Debian.

The King Ant
01-12-2001, 09:24 PM
What you were doing seems right. A few things to try...

The "group" command is supposed to show a listing of all the groups you are a part of. I'd just verify you're actually in the peck group. If not, try logging out and back in again.

If you're still not in the group, look at the /etc/groups file and make sure algemon is listed somewhere to the right of the peck group.

Also, though I'm not sure it'll matter, you might have to change the permissions of the /root directory to the same as the file. You might want to move the test file to /usr/local/share/test.test, or something.

Algemon
01-13-2001, 09:54 AM
Thanks for the help.

You were right. For some reason you have to log out and back in again for the effect of adding a user to a group to work.

This is not the case in RedHat - it happens immediately.

Thanks again.