Preloader image
Side Menu
Perl
-1
archive,category,category-perl,category-7,wp-theme-satellite7,satellite-core-1.0.7,satellite-theme-ver-3.2,ajax_fade,page_not_loaded,smooth_scroll

Perl

How to expand a UNIX group and list all of its members

Recently, I needed a way to show all of the members of a UNIX group.  I’m in the process of writing a sudoers parser and this functionality was needed to show which users could actually run which commands as which users.  After doing some internet research, I came across the following link: http://stackoverflow.com/questions/2835368/how-to-list-all-users-in-a-linux-group. Though it worked, it relied on UNIX commands to build the hash, getent and id.  It was very slow.  The function below…