The names of all the users on the system are kept in
/etc/passwd. This file has the following structure:
Login name
Password (or x if using a
shadow file)
The UID
The GID
Text description for the user
The user's home directory
The user's shell
These 7 fields are separated by colons. As in the example below.
/etc/passwd entry with encrypted passwd:
george:$1$K05gMdDrW2sT.h:Dr G Micheal:/home/georges:/bin/bash
In order to hide the encrypted passwords from ordinary users
you should use a shadow file.
The /etc/shadow file then holds the user names
and encrypted passwords and is readable only by
root.
If you don't have a shadow file in
/etc then you should issue the following
command:
/usr/sbin/pwconv # (passwd -> shadow)
This will leave an x in the 2nd
field of /etc/passwd and create the
/etc/shadow file.
If you don't wish to use shadow passwords you can do so using
/usr/sbin/pwunconv # (shadow -> passwd)
![]() | Caution |
|---|---|
When using a |
In the same way, information about groups is kept in
/etc/group.
This file has 4 fields separated by colons.
Group name
The group password (or x if
gshadow file exists)
The GID
A comma separated list of members
Example /etc/group entry:
java:x:550:jade, eric, rufus
As for users there is a /etc/gshadow file that is
created when using shadow group passwords.
The utilities used to switch backwards and forward from
shadow to non-shadow files are as follows
/usr/sbin/grpconv # creates the /etc/gshadow file /usr/sbin/grpunconv # deletes the gshadow file
![]() | Note |
|---|---|
The |
The /etc/login.defs file and the
/etc/skel directory are only consulted or used
when a new user is added to a system.
The /etc/login.defs file contains the
following information:
MAIL_DIRthe mail spool directory
PASS_MAX_DAYS, PASS_MIN_DAYSpassword aging controls
UID_MIN, UID_MAXmax/min values for automatic UID selection in useradd
GID_MIN, GID_MAXmax/min values for automatic GID selection in groupadd
CREATE_HOMEautomatically create a home directory with useradd
The /etc/skel directory contains default
files that will be copied to the home directory of newly created users:
.bashrc, .bash_profiles, ...