Which file contains information about password policies such as expiry date, modification date, etc?
Which tool will change password policies?
The content of which directory is copied across to the home directory of a newly created user?
In which file are default values such as the
MAX_UID or PASS_MAX_AGE set?
Which tool will create a shadow
file if it doesn't exist yet?
| File | Description |
|---|---|
/etc/group | contains the names of all the groups on the system |
/etc/gshadow | contains (optionally) passwords associated to a group |
/etc/login.defs | contains predefined values needed when adding a new user such as the minimum and maximum UID and GID, the minimum password length, etc |
/etc/passwd | passwd(5). a text file that contains a list of the systems accounts, giving for each account some useful information like user ID, group ID, home directory, shell, etc. Often, it also contains the encrypted passwords for each account. It should have general read permission (many utilities, like ls(1) use it to map user IDs to user names), but write access only for the superuser |
/etc/shadow | shadow(5) contains the encrypted password information for user's accounts and optional the password aging information |
/etc/skel/ | directory containing files and directories to be copied into the home directory of every newly created user |
| Commands | Description |
|---|---|
| chage | changes a user's password expiry information |
| gpasswd | administer the /etc/group file |
| groupadd | add a new group to the system |
| groupmod | modify an exiting group |
| groups | print out all the groups a user belongs to |
| id | print out the UID as well as the GIDs of all the groups a user belongs to |
| passwd | change the password for an account |
| useradd | add a new user to the system |
| usermod | modify an existing user account |
Creating users
Create a group called devel with GID
550
groupadd -g 550 devel
Use adduser to create a user called
tux with user ID 600 and
additional group ID 550
useradd -u 600 -G 550 -m tux
![]() | Note |
|---|---|
the |
Use usermod to change this user's home directory.
usermod -d /home/newtux/ -m tux
Does the new directory need to be created? (Hint: check the effect
of the -m flag)
Is the content of /etc/skel copied to the
new directory?
Use usermod to change tux to
the group wheel.
usermod -G devel,wheel tux
![]() | Note |
|---|---|
If a comma separated list of groups is not given, the user will be assigned to a single extra group. The gpasswd tool will add users to additional groups (see Working with groups below) |
Working with groups
Create a group called sales using groupadd.
groupadd sales
Add tux to this group using
gpasswd.
gpasswd -a tux sales
Login as tux. Use groups
to list the groups you belong to. Join the group sales
using newgrp and list the groups you belong to
(once again).
Conifiguration files
Add a user to the system by editing /etc/passwd,
/etc/group and /etc/shadow.
Create a group called share and add the user
tux to this group by manually editing
/etc/group
Modifying an Account
Change the expiry date for user tux's account
using usermod.
Lock the user's account. (Use tools or edit
/etc/shadow)
Prevent the user from logging in by changing the user's default shell
to /bin/false
Change the PASS_MAX_DAYS for user tux to
1 in /etc/shadow
Changing default settings
Use useradd -D to change the
system's default settings such that every new user will be assigned
/bin/sh instead of /bin/bash.
(Notice that this will change the file in
/etc/defaults/)
Edit /etc/login.defs and change the default
PASS_MAX_DAYS so that new users need to change their
password every 5 days