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

Re: Changing groups



On Thu, 2003-08-14 at 18:12, Mark Roach wrote:
> On Thu, 2003-08-14 at 17:43, Dan Jones wrote:
> > Try it yourself.  Create a new group and add yourself to it.  Then
> > create a file, change it's owner to whoever and its group to the new
> > group.  Set permissions to 770 and try to read the file.
> > 
> > Then use newgrp to change your group and try to read it.
> 
> mrroach@flmrroach:~$ sudo groupadd silly
> mrroach@flmrroach:~$ sudo adduser mrroach silly
> Adding user mrroach to group silly...
> Done.
> mrroach@flmrroach:~$ sudo touch /tmp/sillyfile
> mrroach@flmrroach:~$ sudo chown root:silly /tmp/sillyfile
> mrroach@flmrroach:~$ sudo chmod 770 /tmp/sillyfile
> mrroach@flmrroach:~$ sudo su mrroach
> mrroach@flmrroach:~$ groups
> mrroach lp cdrom floppy audio silly
> mrroach@flmrroach:~$ cat /tmp/sillyfile
> mrroach@flmrroach:~$ echo lalalala >> /tmp/sillyfile
> mrroach@flmrroach:~$ cat /tmp/sillyfile
> lalalala
> mrroach@flmrroach:~$ newgrp lp
> mrroach@flmrroach:~$ cat /tmp/sillyfile
> lalalala
> mrroach@flmrroach:~$ groups
> lp mrroach cdrom floppy audio silly
> mrroach@flmrroach:~$ ls -l /tmp/sillyfile
> -rwxrwx---    1 root     silly           9 Aug 14 18:04 /tmp/sillyfile
> 
> 
> I think you are mistaken...

I'm thoroughly confused, that's what I am.  Did this behavior change at
some point in the past?  Yesterday, I created new groups and assigned
files to those groups.  I logged out, logged back in and tried to access
the files and could not.  I rebooted the machine and tried again.  I
still couldn't access them.

I went to Google.  You read the quote from Linux Unleashed, which is
found here:
http://prognosis.lib.ece.ntua.gr/dimitris/Linux%20Docs/Learning%20Linux%20-Collection%20of%2012%20Ebooks-/Linux%20Unleashed,%20Third%20Edition/ch09/173-176.html

I found this site: 
http://www.wbglinks.net/pages/reads/linux/filepermissions.html
which says "On Linux you are always on one group at a time, even if
your<sic> a member of several. If you need to access files that are
owned by another group that you belong to, you need to use the command
newgrp:"
I won't bore you by digging up the other sites but everything I could
find indicated that Linux only referred to your active group, and that's
the way my system seemed to be acting.  Today, I just tried it again and
it allows me access to the files.  I don't know what I was doing wrong
yesterday, and I don't know why multiple sites are either wrong or
confusingly written.  But my box is now acting the way I thought it
should.  Apologies to Alan and Collin; and thanks to all for setting me
straight.






Reply to: