Bookmark this page

Lab: Managing Local Linux Users and Groups

Performance Checklist

In this lab, you will define a default password policy, create a supplementary group of three new users, and modify the password policy of one user.

Outcomes

  • A new group on serverX called consultants, including three new user accounts for Sam Spade, Betty Boop, and Dick Tracy.

  • All new accounts should require that passwords be changed at first login and every 30 days thereafter.

  • The new consultant accounts should expire at the end of the 90-day contract, and Betty Boop must change her password every 15 days.

Reset your serverX system.

  1. Ensure that newly created users have passwords which must be changed every 30 days.

    [student@serverX ~]$ sudo vim /etc/login.defs
    [student@serverX ~]$ cat /etc/login.defs
    ...Output omitted...
    PASS_MAX_DAYS	30
    PASS_MIN_DAYS	0
    PASS_MIN_LEN	5
    PASS_WARN_AGE	7
    ...Output omitted...
    
  2. Create a new group named consultants with a GID of 40000.

    [student@serverX ~]$ sudo groupadd -g 40000 consultants
    [student@serverX ~]$ tail -5 /etc/group 
    stapdev:x:158:
    pesign:x:989:
    tcpdump:x:72:
    slocate:x:21:
    consultants:x:40000:
    
  3. Create three new users: sspade, bboop, and dtracy, with a password of default and add them to the supplementary group consultants. The primary group should remain as the user private group.

    [student@serverX ~]$ sudo useradd -G consultants sspade
    [student@serverX ~]$ sudo useradd -G consultants bboop
    [student@serverX ~]$ sudo useradd -G consultants dtracy
    [student@serverX ~]$ tail -5 /etc/group     
    slocate:x:21:
    consultants:x:40000:sspade,bboop,dtracy
    sspade:x:1001:
    bboop:x:1002:
    dtracy:x:1003:
    [student@serverX ~]$ sudo passwd sspade
    Changing password for user sspade.
    New password: default
    BAD PASSWORD: The password is shorter than 8 characters
    Retype new password: default
    passwd: all authentication tokens updated successfully.
    [student@serverX ~]$ sudo passwd bboop
    [student@serverX ~]$ sudo passwd dtracy
    
  4. Determine the date 90 days in the future and set each of the three new user accounts to expire on that date.

    [student@serverX ~]$ date -d "+90 days"
    Mon May  5 11:49:24 EDT 2014
    [student@serverX ~]$ sudo chage -E 2014-05-05 sspade
    [student@serverX ~]$ sudo chage -E 2014-05-05 bboop
    [student@serverX ~]$ sudo chage -E 2014-05-05 dtracy
    
  5. Change the password policy for the bboop account to require a new password every 15 days.

    [student@serverX ~]$ sudo chage -M 15 bboop
    [student@serverX ~]$ sudo chage -l bboop
    Last password change                                    : Feb 04, 2014
    Password expires                                        : Feb 19, 2014
    Password inactive                                       : never
    Account expires                                         : May 05, 2014
    Minimum number of days between password change          : 0
    Maximum number of days between password change          : 15
    Number of days of warning before password expires       : 7
    
  6. Additionally, force all users to change their password on first login.

    [student@serverX ~]$ sudo chage -d 0 sspade
    [student@serverX ~]$ sudo chage -d 0 bboop
    [student@serverX ~]$ sudo chage -d 0 dtracy
    
  7. When you finish, run the lab localusers grade evaluation script to confirm you have done everything correctly.

    [student@serverX ~]$ lab localusers grade
    
Revision: rh124-7-1b00421