User Management in Linux

User management includes everything from creating a user to deleting a user on your system. User management can be done in three ways on a Linux system.

Understand the /etc/passwd file

User account information is stored in the /etc/passwd file. This information includes the account name, home directory location, and default shell, among other values. Linux sysadmins should be able to recognize these fields.

Each field is separated by a : character, and not all fields must be populated, but you must delineate them.

Here's an example of the /etc/passwd fields:

username:password:UID:GID:comment:home:shell

example:

dgarn:x:1001:1001::/home/dgarn:/bin/bash

Understand the /etc/shadow file

Administrators should recognize each field in /etc/shadow. Several of the fields pertain to password requirements.

Here's an example of /etc/shadow fields:

username:password:last password change:min:max:warning:inactive:expired

Create, modify, and delete user accounts

The process for managing user accounts is very straightforward. Sysadmins either add, modify, or delete users, and the related commands

  • useradd

  • usermod

  • userdel

Task : Create 2 users and just display their Usernames.

use cat /etc/passwd to display their usernames.

Happy Learning !!

0
Subscribe to my newsletter

Read articles from yashswini thakur directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

yashswini thakur
yashswini thakur

Hi there! My name is Yashswini and I'm a Linux Engineer with 3 years of experience in automation, continuous integration, and deployment. My expertise lies in DevOps and Cloud Computing with a focus on AWS. I have hands-on experience in various tools and technologies related to infrastructure automation, managed services, containerization, and monitoring and logging. I have a passion for troubleshooting and resolving issues and I'm always eager to learn and explore new technologies