Lab 101 : Managing Users and Groups

Learn About User Commands

$ man useradd

$ useradd --help

$ man id

$ id --help

$ man passwd

$ man usermod

$ man userdel

Create a System User

Create the following users,

  • dipti
  • pooja
  • ramesh
  • suresh

Check the Default User Configurations

$ useradd -D

While creating users, mention the option to create home directories.

$useradd -m dipti

$useradd -m ramesh

$useradd -m suresh

$useradd -m dipti

Validate whether the users have been created

** Option 1 : Observe /etc/passwd

$ tail /etc/passwd

Expected Output:

dipti:x:501:501::/home/dipti:/bin/bash ramesh:x:502:502::/home/ramesh:/bin/bash suresh:x:503:503::/home/suresh:/bin/bash pooja:x:504:504::/home/pooja:/bin/bash

** Option 2 : using id command

$ id dipti $ id ramesh $ id suresh $ id pooja

Set Password

Check whether password exists, $ cat /etc/passwd

dipti:!!:16847:0:99999:7:::

Create password for each users, and validate,

$ passwd -m dipti

[Type and retype passwords]

New password: *

Retype new password: *

passwd: all authentication tokens updated successfully.

Validate

Logout as root user, and try logging in as the user you created password for.

$ su - dipti [verify you are able to login]

Also verify the contents of /etc/shadow which should have a encrypted string instead of !!

dipti:$6$t99EyAX/$3VCh3O9qjBEA7aevcRtV57B0HVNSM3WkhIXK9fe2JQMUQrsj8pxz5pDbmrnJIoDlJimes3kd.yXNUNqKpoGpa0:16847:0:99999:7:::