/etc/passwd stores all user account information, its format is:
username:encrypted password:UID:GID:fullname:home directory:login shell
/etc/shadow stores shadow password.
1. Adding users
· Add an entry to /etc/passwd file;
· Create home directory;
· Set permission to let user own the directory;
· Create shell initialization file in the home directory;
Configure other system-wide file.
$useradd command takes /etc/adduser.conf as default configuration.
2. Deleting users
You can temporary disable an account by adding * to the password field in the /etc/passwd.
3. Setting user attributes
$passwd username : change user’s password, only root can change other’s password.
$chfn : change user’s full name.
$chsh: change user’s login shell.
/etc/group stores group and its members information, its format is:
group name:password:GID:other members
In the /etc/passwd, each user was given a default GID, however user may belong to more than one group, his account can be added to /etc/group to participate in that group.
$groups à lists all groups you belong to
$groupadd à add a group
User deletes entry in the /etc/group to delete a group from system.