Thuta Learning
Linux
IntermediateDevOps & ToolsBeginner

Doing Admin Work with sudo & su

LinuxLesson 16

What you'll walk away with

  • Get comfortable doing admin work with sudo & su — no need to fear them
  • Practice running the commands yourself in the terminal
  • See how these commands come in handy on a real server or project

Let's think about it this way for a second

sudo (superuser do) lets you borrow root privilege temporarily, one command at a time — you type your password, and only users on the allowlist get to use it. su (switch user, usually su - root) fully switches you over to being root — every command runs as root, so a single mistake carries more risk of damaging the system. Modern practice (including Ubuntu) disables the root account by default and favors sudo instead — it keeps you conscious of each individual command, which makes it safer.

Let's connect this to a real-world scenario

When you want to install a package, it's sudo apt install <name>; when you want to edit a system-level config file, it's sudo nano /etc/hostname — as an ordinary user, you run regular commands normally and just prepend sudo to the ones that need admin power. Typing sudo -l lets you see which sudo commands your user is allowed to run.

Let's try it together in the terminal

bash
sudo apt update
sudo nano /etc/hostname
sudo -l              # ကိုယ်ရ command list ကြည့်
sudo whoami          # root ပြန်ထွက်, ဒါပေမယ့် ordinary user အနေနဲ့ဆက်နေဆဲ
You should see
Running sudo whoami will return 'root', but once the command finishes, you'll go back to being an ordinary user.

5-Minute Try-It

Try running sudo -l (it may ask for your password). Read the output and check whether your user has admin access.

A Quick Word of Caution

sudo rm -rf is basically 'rm -rf with a permission boost' — a single mistake becomes far worse with root privilege behind it. Always read a sudo command twice before running it.

Easy traps

  • Thinking your sudo password isn't being typed because nothing appears on screen — in Linux, not even characters show up while you type a password (a security feature)
  • Believing every sudo command is safe because 'sudo will catch anything bad' — sudo only grants permission, it doesn't protect you from your own mistakes

Now Try It Yourself

Try running sudo -l (it may ask for your password). Read the output and check whether your user has admin access.

You'll know it worked when: Running sudo whoami will return 'root', but once the command finishes, you'll go back to being an ordinary user.

Updated on

Progress is saved only in this browser on this device. It isn't synced to other devices.

Report a problem with this lessonOpens your email app with this lesson's address filled in — nothing is sent until you send it.

Doing Admin Work with sudo & su | Thuta Learning