/etc/passwd
file, while the /etc/shadow
file stores encrypted passwords. Both are text files, in a relatively simple format, which can be read and modified with a text editor. Each user is listed there on a line with several fields separated with a colon (“:
”).
/etc/passwd
/etc/passwd
file:
rhertzog
;
crypt
or md5
. The special value “x
” indicates that the encrypted password is stored in /etc/shadow
;
uid
: unique number identifying each user;
gid
: unique number for the user's main group (Debian creates a specific group for each user by default);
GECOS
: data field usually containing the user's full name;
$HOME
generally points here);
/bin/false
(which does nothing and returns control immediately), the user can not login.
/etc/shadow
/etc/shadow
file contains the following fields:
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
field. chsh
(CHange SHell) allows the user to change their login shell, however available choices will be limited 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 of their choosing.
chage
(CHange AGE) command allows the administrator to change the password expiration settings (the -l user
option will list the current settings). You can also force the expiration of a password using the passwd -e user
command, which will require the user to change their password the next time they log in.
passwd -l user
(lock). Re-enabling the account is done in similar fashion, with the -u
option (unlock).
/etc/group
/etc/group
file, a simple textual database in a format similar to that of the /etc/passwd
file, with the following fields:
newgrp
or sg
commands, see sidebar);
gid
: unique group identification number
groupadd
and groupdel
commands add or delete a group, respectively. The groupmod
command modifies a group's information (its gid
or identifier). The command passwd -g group
changes the password for the group, while the passwd -r -g group
command deletes it.