Passwd::Unix provides an abstract object-oriented and function interface to standard Unix files, such as /etc/passwd, /etc/shadow, /etc/group. Additionally this module provides environment to testing new software, without using system critical files in /etc/dir.

The Passwd::Unix module provides an abstract interface to /etc/passwd, /etc/shadow and /etc/group format files. It is inspired by Unix::PasswdFile module (that one does not handle /etc/shadow file, what is necessary in modern systems like Sun Solaris 10 or Linux).

Read or modify a user's password. If you have a plaintext password, use the encpass method to encrypt it before passing it to this method. Returns the result of operation (1 or undef) if PASSWD was specified. Otherwhise returns the PASSWD.

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.

This method can add, modify, or return information about a group. Supplied with a single groupname parameter, it will return a two element list consisting of (GID, ARRAYREF), where ARRAYREF is a ref to array consisting names of users in this GROUP. It will return undef and ref to empty array (undef, [ ]) if no such group exists. If you supply all three parameters, the named group will be created or modified if it already exists.