Hi jr,

> >    $     awk -F: '$1 == "root" || $3 ~ /^0*$/ {print NR, $0}' /etc/group
> >    1 root:x:0:
> 
> just wondering why the last field's empty (and doesn't contain user
> 'root')?
> 
> man (5) group specifies:  group_name:passwd:GID:user_list

group(5) looks like a bit of a poor stub man page on this system;
user_list is allowed to be empty.  Since /etc/passwd specifies the group
ID used when I log in, that group often doesn't have my user name listed
against it in /etc/group.

    $ g "^$USER:" /etc/passwd
    ralph:x:1000:1000:Ralph Corderoy,,,:/home/ralph:/bin/bash
    $ awk -F: '$3 == 1000' /etc/group
    ralph:x:1000:
    $ 

The groups that normally do have users listed are those that aren't the
initial group for any one particular user.  newgrp(1) will still let me
change to group `ralph' even though I'm not explicitly listed in
/etc/group.

    $ id -gn; id -gnr
    ralph
    ralph
    $ newgrp users
    $ id -gn; id -gnr
    users
    users
    $ newgrp
    $ id -gn; id -gnr
    ralph
    ralph
    $ 

If you want to play around with this kind of thing, then

    perl -le 'print "$(\n$)"'

can also be useful.  perlvar(1) explains their contents.

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