MAN page from Old RedHat 7.X perl-Unix-ConfigFile-0.05-8.i386.rpm
PasswdFile
Section: User Contributed Perl Documentation (3)
Updated: perl v5.6.0
Index NAME
Unix::PasswdFile - Perl interface to /etc/passwd format files
SYNOPSIS
use Unix::PasswdFile;
$pw = new Unix::PasswdFile, "/etc/passwd"; $pw->user("joeblow", $pw->encpass("secret"), $pw->maxuid + 1, 10, "Joe Blow", "/export/home/joeblow", "/bin/ksh"); $pw->delete("deadguy"); $pw->passwd("johndoe", $pw->encpass("newpass")); foreach $user ($pw->users) { print "Username: $user, Full Name: ", $pw->gecos($user), "\n"; } $pw->commit(); undef $pw; DESCRIPTION
The Unix::PasswdFile module provides an abstract interface to /etc/passwdformat files. It automatically handles file locking, getting colons in theright places, and all the other niggling details.
METHODS
commit( [BACKUPEXT] )
See the Unix::ConfigFile documentation for a description of this method.
delete( USERNAME )
This method will delete the named user. It has no effect if the supplied userdoes not exist.
encpass( PASSWORD )
See the Unix::ConfigFile documentation for a description of this method.
gecos( USERNAME [,GECOS] )
Read or modify a user's
GECOS string (typically their full name). Returnsthe
GECOS string in either case.
gid( USERNAME [,GID] )
Read or modify a user's
GID. Returns the
GID in either case.
home( USERNAME [,HOMEDIR] )
Read or modify a user's home directory. Returns the home directory in eithercase.
maxuid( )
This method returns the maximum
UID in use by all users.
new( FILENAME [,OPTIONS] )
See the Unix::ConfigFile documentation for a description of this method.
passwd( USERNAME [,PASSWD] )
Read or modify a user'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.
rename( OLDNAME, NEWNAME )
This method changes the username for a user. If
NEWNAME corresponds to anexisting user, that user will be overwritten. It returns 0 on failure and 1on success.
shell( USERNAME [,SHELL] )
Read or modify a user's shell. Returns the shell in either case.
uid( USERNAME [,UID] )
Read or modify a user's
UID. Returns the
UID in either case.
user( USERNAME [,PASSWD, UID, GID, GECOS, HOMEDIR, SHELL] )
This method can add, modify, or return information about a user. Suppliedwith a single username parameter, it will return a six element list consistingof (
PASSWORD,
UID,
GID,
GECOS,
HOMEDIR,
SHELL), or undef if no such userexists. If you supply all seven parameters, the named user will be createdor modified if it already exists. The six element list is also returned toyou in this case.
users( [SORTBY] )
This method returns a list of all existing usernames. By default the listwill be sorted in order of the UIDs of the users. You may also supply ``name''as a parameter to the method to get the list sorted by username. In scalarcontext, this method returns the total number of users.
AUTHOR
Steve Snodgrass, ssnodgraAATTfore.com
SEE ALSO
Unix::AliasFile, Unix::AutomountFile, Unix::ConfigFile, Unix::GroupFile
Index
- NAME
- SYNOPSIS
- DESCRIPTION
- METHODS
- commit( [BACKUPEXT] )
- delete( USERNAME )
- encpass( PASSWORD )
- gecos( USERNAME [,GECOS] )
- gid( USERNAME [,GID] )
- home( USERNAME [,HOMEDIR] )
- maxuid( )
- new( FILENAME [,OPTIONS] )
- passwd( USERNAME [,PASSWD] )
- rename( OLDNAME, NEWNAME )
- shell( USERNAME [,SHELL] )
- uid( USERNAME [,UID] )
- user( USERNAME [,PASSWD, UID, GID, GECOS, HOMEDIR, SHELL] )
- users( [SORTBY] )
- AUTHOR
- SEE ALSO
This document was created byman2html,using the manual pages.