5.2.2. Modifying an Existing Account or Password
The following commands allow modification of the information stored in specific fields of the user
databases:
•
passwd
—permits a regular user to change their password, which in turn, updates the
/etc/
shadow
file.
•
chfn
—(CHange Full Name), reserved for the super-user (root), modifies the GECOS, or ”gen-
eral information” field.
•
chsh
—(CHange SHell) changes the user’s login shell. However, available choices will be lim-
ited to those listed in
/etc/shells
; the administrator, on the other hand, is not bound by
this restriction and can set the shell to any program chosen.
•
chage
—(CHange AGE) allows the administrator to change the password expiration settings
by passing the user name as an argument or list current settings using the -l
user
option.
Alternatively, you can also force the expiration of a password using the
passwd -e
user
command, which forces the user to change their password the next time they log in.
5.2.3. Disabling an Account
You may find yourself needing to disable an account (lock out a user) as a disciplinary measure, for
the purposes of an investigation, or simply in the event of a prolonged or definitive absence of a
user. A disabled account means the user cannot login or gain access to the machine. The account
remains intact on the machine and no files or data are deleted; it is simply inaccessible. This is
accomplished by using the command
passwd -l
user
(lock). Re-enabling the account is done in
similar fashion, with the -u option (unlock).
5.2.4. Managing Unix Groups
The
addgroup
and
delgroup
commands add or delete a group, respectively. The
groupmod
com-
mand modifies a group’s information (its gid or identifier). The command
gpasswd
group
changes
the password for the group, while the
gpasswd -r
group
command deletes it.