LCFG::Utils::PasswdFile::Entry - Unix passwd file entry
This documentation refers to LCFG::Utils::PasswdFile::Entry version 1.2.1
use LCFG::Utils::PasswdFile::Entry;
my $entry = LCFG::Utils::PasswdFile::Entry->new_from_string(
"root:x:0:0:root:/root:/bin/bash");
$entry->shell("/bin/sh");
print $entry->to_string;
This module provides an object-oriented representation of an entry in the Unix passwd file. It can parse the traditional, colon-delimited, Unix passwd file entry format. Fields can be updated and entirely new entries can also be created.
The primary purpose of this module is to be used with the LCFG::Utils::PasswdFile class.
This field represents the username. This is a read-only field, it cannot be altered.
This field represents the user ID (UID). This is a read-only field, it cannot be altered.
This is the password field for the user. Note that this module does not support encrypting the password for you, that needs to be done separately.
This field represents the primary group ID (gid) for the user.
This field represents the GECOS, this is typically used to record general information about the account or its user.
This field represents the home directory for the user.
This field represents the login shell for the user.
This creates a new, empty, LCFG::Utils::PasswdFile::Entry object.
This method parses the string which contains a Unix passwd file entry in the standard colon-separated format. The fields are then used to create a new LCFG::Utils::PasswdFile::Entry object.
This method will die if too many or too few fields are found in the string.
This will take the stored values for the various fields (see above for details) and return a string in the standard colon-separated format. Any fields which have not been defined will be left empty.
This compares an object to another and returns a boolean which represents whether or not the contents of the two objects are identical.
This compares an object to another and returns a boolean which represents whether or not the contents of the two objects are compatible. The definition of compatible is that the two objects have the same UID and username (all other fields are allowed to be different).
This method can be used to sort entries, it returns the standard values -1, 0, or 1 to signify which entry should come first. The order is based on numerically sorting on UID and then, if necessary, alphabetically sorting on username.
This module requires Class::Accessor, List::MoreUtils, and Readonly.
LCFG::Utils::PasswdFile, LCFG::Utils::GroupFile, LCFG::Utils::GroupFile::Entry, LCFG::Component::Auth
This is the list of platforms on which we have tested this software. We expect this software to work on any Unix-like platform which is supported by Perl.
Scientific5, Scientific6, Fedora13
Please report any bugs or problems (or praise!) to bugs@lcfg.org, feedback and patches are also always very welcome.
Alastair Scobie <ascobie@inf.ed.ac.uk>, Stephen Quinney <squinney@inf.ed.ac.uk>
Copyright (C) 2011 University of Edinburgh. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the terms of the GPL, version 2 or later.