C

Linux › Module 3 › Lesson 3

BeginnerModule 3Lesson 3/5

sudo & Root Access

Use sudo safely and understand root privileges on Linux

15 min+40 XP3 quiz
Module progress3 of 5

Opening

With great power comes great rm -rf

root can install software, change any permission, and shut down the system. sudo lets trusted users run specific commands as root—without logging in as root all day. That is both convenience and security.

1. What sudo Does

sudo means "superuser do." Prefix a command to run it with elevated privileges: sudo apt update sudo systemctl restart ssh sudo nano /etc/hosts You authenticate (usually your password), and the action is logged.

2. Why Not Log In as root?

Running a browser or email client as root is dangerous—any exploit owns the entire box. Best practice: daily work as a normal user; sudo only when needed. Kali is an exception for labs, not a lifestyle.

3. sudo vs su

  • sudo command

    Runs one command as root (or another user). Preferred.

  • su -

    Switches your whole shell to root until you exit. Easy to forget you are root.

Audit trail

On servers, check /var/log/auth.log (Debian/Ubuntu) for sudo usage. Defenders look for unusual sudo at odd hours—attackers love stolen creds with sudo rights.

Knowledge Check

1

What is the main purpose of sudo?

Multiple choice

Knowledge Check

2

Why is daily browsing as root discouraged?

Multiple choice

Knowledge Check

3

True or False: sudo actions are often logged for security auditing.

True or False

← Previous

Answer all 3 knowledge checks to continue. (0/3 answered)