Module 3 · Linux and Windows Administration · Lesson 7 of 75

Linux administration for security

The Linux file system, users and groups, permissions, sudo, packages, services and the logs that matter, practised in a live terminal.

In this lesson · about 40 minutes

  • Find your way around the Linux file system and its key security files
  • Read and set permissions, and use sudo safely
  • Manage packages and services, and read authentication logs

Where things live

PathWhat is thereSecurity interest
/etcSystem settings/etc/passwd (accounts), /etc/shadow (password hashes, root-only), /etc/sudoers, /etc/ssh/sshd_config
/var/logLogsauth.log or secure (logins, sudo), syslog, web server logs
/homeUsers' files~/.ssh/authorized_keys, ~/.bash_history
/rootThe root user's homeShould only be readable by root
/tmp, /dev/shmTemporary files, writable by everyoneA favourite place for attackers to drop tools
/bin, /usr/bin, /sbinProgramsReplaced binaries are a sign of a rootkit
/etc/cron*, /etc/systemd/systemScheduled jobs and servicesCommon persistence locations

Users, groups and sudo

  • Every account has a line in /etc/passwd: alice:x:1001:1001:Alice:/home/alice:/bin/bash (name, password placeholder, user ID, group ID, comment, home, shell). UID 0 is root: any account with UID 0 is all-powerful, whatever its name.
  • Create and manage accounts with sudo useradd -m -s /bin/bash alice, sudo passwd alice, sudo usermod -aG sudo alice (add to the sudo group), sudo usermod -L alice (lock).
  • sudo runs one command as root and logs it. Check who can use it with sudo -l and getent group sudo. Lines with NOPASSWD in /etc/sudoers deserve a hard look.

Permissions

ls -l shows -rwxr-x---: the file type, then read/write/execute for the owner, the group and others. In numbers, r = 4, w = 2, x = 1, so rwxr-x--- = 750. Sensible defaults: 644 for normal files, 600 for private keys and secrets, 755 for programs and folders. Two special bits to watch: SUID (the program runs as its owner, often root; find them with find / -perm -4000 2>/dev/null) and world-writable files (find / -perm -o+w -type f). Both are classic privilege-escalation paths (Module 14).

Packages and services

  • Debian/Ubuntu/Kali: sudo apt update && sudo apt upgrade. Red Hat family: sudo dnf upgrade.
  • Services: systemctl status ssh, sudo systemctl stop|start|restart|enable|disable nginx, systemctl list-units --type=service --state=running.
  • Logs: journalctl -u ssh --since today, sudo tail -f /var/log/auth.log, last (recent logins), lastb (failed ones).

Try it · watch it happen

Permission builder: who may do what

Tick the boxes to build a permission set and watch the number and the rwx string change together. Try to make 600, 644, 750 and 755.

👀 Read (4)✏️ Write (2)▶️ Execute (1)Adds up to
Ownerlearner4 + 2 + 0 = 6
Grouplearner2 (in labgroup)4 + 2 + 0 = 6
Othersguest (everyone else)4 + 0 + 0 = 4
-rw-rw-r--=chmod 664

🧑 learner

✓ can open and read it

✓ can change it

✗ can run it as a program

👥 learner2 (in labgroup)

✓ can open and read it

✓ can change it

✗ can run it as a program

🌍 guest (everyone else)

✓ can open and read it

✗ can change it

✗ can run it as a program

Doors along the way: can learner2 reach /home/learner/lab/notes.txt?

To open a file you must pass through every folder before it. A folder's x permission is its door.

/home
→
/home/learner
→
lab/
→
notes.txt

Try it · watch it happen

Users wear group badges

Add people to groups and see who can open which files. Notice how a group lets you give access to a team without touching each file.

On the system (the official list)

learner2

🏷️ learner2🏷️ developers

Their open terminal (snapshot from login)

learner2developers
learner2 is logged in. Their badges: learner2 (their own), developers.

Practice terminal · missions

Lab: a quick security check of a Linux box

You are Sam on a small practice server. Work through the missions; the picture on the right shows the files and processes as you go. Type help to see the commands this practice terminal knows.

Missions 0 of 8

  1. 1Confirm which account you are using.
  2. 2List your home folder with details and hidden files.
  3. 3Try to read the system log /var/log/syslog as Sam.
  4. 4Read it again as administrator, keeping only the sshd lines.
  5. 5List every process on the machine.
  6. 6It is Sam's own runaway report job (PID 3150). Stop it politely.
  7. 7Make notes.txt readable and writable by Sam only, using numbers.
  8. 8Find files bigger than 10 MB in your home folder.
sam@practice-box:~

Type a command and press Enter. Try help to list commands. Tab finishes names, ↑ repeats.

  • ~ (/home/sam)you are here
  • documents
  • budget-2026.csv
  • letters
  • thank-you.txt
  • meeting-notes.txt
  • resume.pdf
  • downloads
  • installer.zip
  • report-final-v2.pdf
  • report-final.pdf
  • logs
  • access.log
  • app.log
  • old
  • app-2026-09.log
  • app-2026-10.log
  • notes.txt
  • photos
  • beach.jpg
  • cat.png
  • trip
  • day1.jpg
  • day2.jpg
  • projects
  • website
  • index.html
  • style.css
  • scripts
  • backup.sh
  • hello.shruns
  • todo.md

This picture updates as you type. Changed items flash. runs = executable, a name badge = owned by someone else.

Check your understanding0 of 4 correct

Question 1

1.Which file holds Linux password hashes?

Question 2

2.You find an account named 'backup' with UID 0. Why is that alarming?

Question 3

3.What does chmod 750 give?

Question 4

4.Where do you look first for SSH login attempts on Ubuntu?

Quiz score: 0 of 4

Tip: answer every quiz question correctly first.

Written by Noviq Academy in its own words. All labs are simulations: no real systems are touched, and every name, address, password and hash is made up. The offensive techniques taught here are for defending systems and for authorised testing only; never scan, access or test a system without the owner's written permission. Tool and product names belong to their owners, and command output may differ slightly from yours. Read-aloud uses your device's built-in voices.