MAN page from Old RedHat 6.X perl-Unix-ConfigFile-0.05-6.i386.rpm
GroupFile
Section: User Contributed Perl Documentation (3)
Updated: perl 5.005, patch 03
Index NAME
Unix::GroupFile - Perl interface to /etc/group format files
SYNOPSIS
use Unix::GroupFile;
$grp = new Unix::GroupFile, "/etc/group"; $grp->group("bozos", "*", $grp->maxgid + 1, @members); $grp->remove_user("coolgrp", "bgates", "badguy"); $grp->add_user("coolgrp", "joecool", "goodguy"); $grp->remove_user("*", "deadguy"); $grp->passwd("bozos", $grp->encpass("newpass")); $grp->commit(); undef $grp; DESCRIPTION
The Unix::GroupFile module provides an abstract interface to /etc/group formatfiles. It automatically handles file locking, getting colons and commas inthe right places, and all the other niggling details.
This module also handles the annoying problem (at least on some systems) oftrying to create a group line longer than 512 characters. Typically this isdone by creating multiple lines of groups with the same GID. When a newGroupFile object is created, all members of groups with the same GID aremerged into a single group with a name corresponding to the first name foundin the file for that GID. When the file is commited, long groups are writtenout as multiple lines of no more than 512 characters, with numbers appended tothe group name for the extra lines.
METHODS
add_user( GROUP, @USERS )
This method will add the list of users to an existing group. Users that arealready members of the group are silently ignored. The special group name *will add the users to every group. Returns 1 on success or 0 on failure.
commit( [BACKUPEXT] )
See the Unix::ConfigFile documentation for a description of this method.
delete( GROUP )
This method will delete the named group. It has no effect if the suppliedgroup does not exist.
encpass( PASSWORD )
See the Unix::ConfigFile documentation for a description of this method.
gid( GROUP [,GID] )
Read or modify a group's
GID. Returns the
GID in either case. Note that itis illegal to change a group's
GID to a
GID that is already in use by anothergroup. In this case, the method returns undef.
group( GROUP [,PASSWD, GID, @USERS] )
This method can add, modify, or return information about a group. Suppliedwith a single group parameter, it will return a list consisting of (
PASSWORD,
GID,
@MEMBERS), or undef if no such group exists. If you supply at leastthree parameters, the named group will be created or modified if it alreadyexists. The list is also returned to you in this case. Note that it isillegal to specify a
GID that is already in use by another group. In thiscase, the method returns undef.
groups( [SORTBY] )
This method returns a list of all existing groups. By default the list willbe sorted in order of the GIDs of the groups. You may also supply ``name'' as aparameter to the method to get the list sorted by group name. In scalarcontext, this method returns the total number of groups.
maxgid( )
This method returns the maximum
GID in use by all groups.
members( GROUP [,@USERS] )
Read or modify the list of members associated with a group. If you specifyany users when you call the method, all existing members of the group areremoved and your list becomes the new set of members. In scalar context,this method returns the total number of members in the group.
new( FILENAME [,OPTIONS] )
See the Unix::ConfigFile documentation for a description of this method.
passwd( GROUP [,PASSWD] )
Read or modify a group's password. Returns the encrypted password in eithercase. If you have a plaintext password, use the encpass method to encrypt itbefore passing it to this method.
remove_user( GROUP, @USERS )
This method will remove the list of users from an existing group. Users thatare not members of the group are silently ignored. The special group name *will remove the users from every group. Returns 1 on success or 0 on failure.
rename_user( OLDNAME, NEWNAME )
This method will change one username to another in every group. Returns thenumber of groups affected.
AUTHOR
Steve Snodgrass, ssnodgraAATTfore.com
SEE ALSO
Unix::AliasFile, Unix::AutomountFile, Unix::ConfigFile, Unix::PasswdFile
Index
- NAME
- SYNOPSIS
- DESCRIPTION
- METHODS
- add_user( GROUP, @USERS )
- commit( [BACKUPEXT] )
- delete( GROUP )
- encpass( PASSWORD )
- gid( GROUP [,GID] )
- group( GROUP [,PASSWD, GID, @USERS] )
- groups( [SORTBY] )
- maxgid( )
- members( GROUP [,@USERS] )
- new( FILENAME [,OPTIONS] )
- passwd( GROUP [,PASSWD] )
- remove_user( GROUP, @USERS )
- rename_user( OLDNAME, NEWNAME )
- AUTHOR
- SEE ALSO
This document was created byman2html,using the manual pages.