Managing Users In Linux

VISHAL D BHAT
May 11, 2022

In this article, we will learn :

  1. Add users into the server
  2. Create a SuperHero group
  3. Set `wheel` Group as the the `tstark` Account’s Primary Group
  4. Add `superhero` as a Supplementary Group on All Three Users
  5. Lock an account

Adding a User into Server

  1. $ssh user_name@publicIPAddress

Enter the Password : — —

Login as the remote user/ root user of your system.

(To login as Root : $ sudo -i )

2. Adding users:

$useradd tstark

$useradd user1

$useradd user2

$groupadd superhero (should have root previleges to execute this function)

3. Set `wheel` Group as the the `tstark` Account’s Primary Group

$usermod -g wheel tstark

$id tstark

  • uid=1002(tstark) gid=10(wheel) groups=10(wheel)

4. Add superheroes group as supplementary group on all the 3 users

$usermod -aG superhero tstark

$usermod -aG superhero user1

$id user1

5. Lock the user

$usermod -L user1

--

--