Hi jr,

> >    ralph:x:1000:1000:Ralph Corderoy,,,:/home/ralph:/bin/bash
> >    ralph:x:1000:
> > newgrp(1) will still let me change to group `ralph' even though I'm
> > not explicitly listed in /etc/group.
> 
> so what you're saying is that newgrp allows you to change group *to*
> the group that you're in already?

I didn't say that, I don't think, but yes, it does.  What I was saying
is that the groups you can change to are those where you're mentioned in
/etc/groups plus the default group ID given for you in /etc/passwd.  So
it doesn't matter if that default GID doesn't mention you in /etc/group.

> ie GID 1000 is your default group, and you can execute 'newgrp ralph'
> straight after a login?

Yes, or just plain `newgrp' since it then uses your default GID from
/etc/passwd.

> doesn't work for me here, I can change to other groups (which I'm a
> member of) only.

On this machine, group ID for `ralph' is 1000, and `admin' is 114.

    $ echo `id -gr` `id -g` `id -G`
    1000 1000 1000 4 20 21 24 25 26 29 30 44 46 100 109 111 114 122
    $ exec newgrp ralph
    $ echo `id -gr` `id -g` `id -G`
    1000 1000 1000 4 20 21 24 25 26 29 30 44 46 100 109 111 114 122
    $ exec newgrp
    $ echo `id -gr` `id -g` `id -G`
    1000 1000 1000 4 20 21 24 25 26 29 30 44 46 100 109 111 114 122
    $ exec newgrp admin
    $ echo `id -gr` `id -g` `id -G`
    114 114 114 4 20 21 24 25 26 29 30 44 46 100 109 111 122 1000
    $ exec newgrp ralph
    $ echo `id -gr` `id -g` `id -G`
    1000 1000 1000 4 20 21 24 25 26 29 30 44 46 100 109 111 114 122
    $ exec newgrp admin
    $ echo `id -gr` `id -g` `id -G`
    114 114 114 4 20 21 24 25 26 29 30 44 46 100 109 111 122 1000
    $ exec newgrp
    $ echo `id -gr` `id -g` `id -G`
    1000 1000 1000 4 20 21 24 25 26 29 30 44 46 100 109 111 114 122
    $ 

Cheers,
Ralph.


--
Next meeting:  Blandford Forum, Tuesday 2010-09-07 20:00
Meets, Mailing list, IRC, LinkedIn, ...  http://dorset.lug.org.uk/
How to Report Bugs Effectively:  http://bit.ly/4sACa

Reply via email to