GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  UNIX::PASSWDFILE (3)

.ds Aq ’

NAME

Unix::PasswdFile - Perl interface to /etc/passwd format files

CONTENTS

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/passwd format files. It automatically handles file locking, getting colons in the right 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 user does 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). Returns the 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 either case.

    maxuid( [IGNORE] )

This method returns the maximum UID in use by all users. If you pass in the optional IGNORE parameter, it will ignore all UIDs greater or equal to IGNORE when doing this calculation. This is useful for excluding accounts like nobody.

    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 either case. If you have a plaintext password, use the encpass method to encrypt it before passing it to this method.

    rename( OLDNAME, NEWNAME )

This method changes the username for a user. If NEWNAME corresponds to an existing user, that user will be overwritten. It returns 0 on failure and 1 on 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. Supplied with a single username parameter, it will return a six element list consisting of (PASSWORD, UID, GID, GECOS, HOMEDIR, SHELL), or undef if no such user exists. If you supply all seven parameters, the named user will be created or modified if it already exists. The six element list is also returned to you in this case.

    users( [SORTBY] )

This method returns a list of all existing usernames. By default the list will 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 scalar context, this method returns the total number of users.

AUTHOR

Steve Snodgrass, ssnodgra@fore.com

SEE ALSO

Unix::AliasFile, Unix::AutomountFile, Unix::ConfigFile, Unix::GroupFile
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 PASSWDFILE (3) 2000-05-02

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.