DEV Community

Cover image for Mastering User Management, Authentication, and Process Monitoring in Linux" published
AugustineOzor
AugustineOzor

Posted on

Mastering User Management, Authentication, and Process Monitoring in Linux" published

Table of Contents

  1. Switch Users and sudo Access
  2. Monitor Logged-In Users
  3. Communicate with Logged-In Users
  4. Linux Account Authentication
  5. Account Types and Directory Services
  6. Useful System Utility Commands
  7. Processes and Jobs
  8. Managing Services and Jobs

Description
Learn how to manage users, monitor sessions, use sudo, and handle Linux processes and services with practical command-line examples.

This guide covers a wide range of foundational topics in Linux system administration, including user switching, sudo access, monitoring user sessions, account authentication, and managing services and processes.

Switch Users and sudo Access

Linux allows you to switch users or run administrative commands without fully logging into another account.

Switch User:

sudo su - username
Temporarily switch to another user’s shell. Useful when performing actions as another user.
Image description

Run as Superuser

sudo command
Execute one command with superuser privileges. Safer than logging in as root.

sudo command

visudo
This safely opens the */etc/sudoers * file for editing, which controls sudo permissions. Avoid editing this file directly.
Image description

alice ALL=(ALL) NOPASSWD: ALL
This allows the user alice to run any command as sudo without being prompted for a password.
Image description

Monitor Logged-In Users

Linux provides tools to view user activity and login history, which is helpful for security and troubleshooting.
who
Shows who is currently logged in and from where.
Image descriptionImage description
last
Displays login history using data from /var/log/wtmp.
Image descriptionImage description

w
Gives detailed information about current users and their active processes.
Image descriptionImage description

id Displays UID, GID, and group memberships of the specified user.
Image descriptionid admin-1Image description

Communicate with Logged-In Users

You can send messages to users on the system using these commands.
users Prints the usernames of users currently logged in. Image description
wall Broadcasts a message to all terminal users.
Image description
`wall system will be updated on Monday 25th at 2pm
Image description

write Sends a direct message to another user’s terminal. Type your message and press** Ctrl+D **to send.Image description
write admin-1
Image descriptionImage description
I logged on to admin-1 user on a different terminal and you can see the message was sent to the user successfully.

Linux Account Authentication

Linux authentication verifies a user’s identity. Accounts can be stored locally or managed centrally through a directory service.

  • Local accounts: Defined in /etc/passwd, managed on the local machine.
  • Domain accounts: Managed through centralized systems like LDAP or Active Directory.

Account Types and Directory Services

Different systems are used to manage identities and authentication across networks.

Directory Service Description
Active Directory Microsoft’s centralized directory system
IDM Red Hat’s Identity Manager (based on FreeIPA)
WinBIND Allows Linux systems to authenticate against AD via Samba
OpenLDAP Open-source implementation of LDAP
IBM Directory IBM’s enterprise-grade directory service
JumpCloud Cloud-based directory platform
LDAP Lightweight Directory Access Protocol, used for querying and modifying directory services

Useful System Utility Commands

Basic system utilities that help admins quickly gather information about the system

Command Description
date Displays current date and time
uptime Shows how long the system has been running
hostname Displays or sets the system’s hostname
uname Displays kernel and system information
which Finds the location of a command
cal Displays a calendar
bc Basic calculator

Processes and Jobs

Processes are instances of running programs. Jobs may refer to background or scheduled tasks.

  • Applications: GUI or command-line programs
  • Scripts: Shell or other language scripts
  • Processes: Running instances of programs
  • Daemons: Background services (e.g., sshd)
  • Threads: Lightweight processes running within a parent process
  • Jobs: Commands or tasks sent to the background or scheduled

Managing Services and Jobs

Manage services and processes using the following tool.
systemctl / service
sudo systemctl status crond Check service status (systemd and SysV init compatible).
sudo service nginx status - will show the same result
Image description

ps Shows a snapshot of all running processes. There are several options you can with ps.

Image descriptionImage descriptionImage description

top Real-time view of system performance and resource usage.
Image descriptionImage description

kill Terminates a process by PID.
Image description
kill process ID

crontab -e Schedules recurring tasks (cron jobs).
Image descriptionImage descriptionImage description
Breakdown

  • 0 → Minute (0th minute)
  • 17 → Hour (5 PM, in 24-hour format)
  • * * * - Every day of the month, every month, every day of the week
  • /home/student/backup.sh - Full path to the script or command to execute

These commands and concepts are essential for effective Linux administration. Whether you're building automation with Ansible, managing user accounts, or monitoring system processes, mastering these tools will greatly increase your confidence and efficiency.

Top comments (0)