A trick I learned recently...since the pacticular machine I was on is
tied into the ldap server for uid & gid..

$> getent group | egrep foofoo | cut -f3 -d:

This would return all groups which the user foofoo belongs to.

There is a more elegant way to do it in a perl script:

sub get_gidnumber
{ 
  # Returns the gidNumber for a given username
  my($user_i_am_searching_for) = @_;
  my(@line);
  my($retval);

  open (GROUP,"getent group |")

  while (<GROUP>) 
  {
    chomp;
    @line = split (/:/, $_);
    if ($line[0] eq $user_i_am_searching_for)
    {
      $retval=$line[2];
    }
  }
  close(GROUP);
  return($retval);
}

- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html

Reply via email to