RedTeam Nexus Labs
Module 03 · Lesson 04 // Users & Groups

accounts

Users & Groups · Linux

Freereading · 10 min
On this page
LESSON

Overview

Accounts are created, modified, and removed over a system's life, and administrative tasks often require elevating privileges temporarily. This lesson covers account management concepts and the safe way to gain administrative rights with sudo.

Learning objectives

  • Describe how accounts are managed at a high level.
  • Explain the role of sudo for privilege elevation.
  • Contrast sudo with logging in as root.

Core concept

Administrators manage accounts with tools like useradd/adduser (create), usermod (modify), passwd (set/change passwords), and userdel (remove). Rather than logging in as root for administrative work, the standard practice is to use sudo ("superuser do"): a regular user with permission runs a single command with elevated privileges, e.g. sudo <command>.

This keeps you operating as a normal user by default and elevating only for the specific action that needs it.

How it works

sudo checks whether your account is authorized (typically via membership in the sudo or wheel group, and rules in /etc/sudoers), prompts for your own password, and runs just that one command with elevated rights — then you are back to normal privileges. This is safer than a persistent root session because the elevation is scoped to individual commands and logged, creating an audit trail of who did what. Direct root login, by contrast, gives an open-ended powerful session with weaker accountability.

Practical example

$ apt update
Reading package lists... E: Could not open lock file (Permission denied)
$ sudo apt update
[sudo] password for alice:
... (runs with elevated privileges) ...

The first attempt fails because updating packages needs elevated rights; prefixing sudo (and entering Alice's password) runs that single command as the superuser, after which Alice is back to her normal privilege level.

Cybersecurity relevance

sudo is central to least-privilege administration and accountability: because each elevation is authorized and logged, investigators can trace privileged actions to a specific user. Misconfigured sudoers rules (e.g. allowing a user to run a powerful command without a password, or overly broad permissions) are a common privilege-escalation avenue that testers look for. Preferring sudo over shared root logins also avoids an anonymous, unaccountable superuser.

Common mistakes

  • Logging in as root for routine work instead of using scoped, logged sudo.
  • Thinking sudo asks for the root password — it normally asks for your own password.
  • Overlooking sudoers misconfigurations, a frequent privilege-escalation path.

Key takeaways

  • Accounts are managed with tools like useradd/adduser, usermod, passwd, and userdel.
  • sudo elevates privileges for a single command (authorized via sudo/wheel group and /etc/sudoers), prompting for your own password.
  • sudo supports least privilege and accountability (scoped, logged elevation); misconfigured sudoers rules are a common privilege-escalation risk.

Check your understanding

  • Why is using sudo for administrative tasks generally safer than logging in as root?
  • Whose password does sudo normally prompt for, and how is a user authorized to use it?
FINISH THIS LESSON

Sign in to save your progress.