Introduction
This lesson is about the everyday security checks a Linux administrator should be able to perform.
The main question is:
What routine security tasks help you reduce risk on a Linux system, and which commands should you know to inspect users, privileges, open services, and password aging?
What you should be able to do after this lesson:
- Inspect open ports and listening services.
- Find SUID and SGID files.
- Understand password aging basics.
- Use
sudosafely and know whyvisudomatters. - Inspect login history and current sessions.
- Understand shell limits with
ulimit.
Big Idea: Security Administration Is Mostly Careful Inspection
At LPIC-1 level, security work is less about advanced cryptography and more about good habits:
- know who can log in
- know which services are exposed
- know which files run with special privileges
- know when passwords expire
- know who has administrative access
That is the level of thinking you want here.
Open Ports and Listening Services
Network exposure is one of the first things to inspect.
Useful commands:
ss -tulpn
sudo ss -tulpn
If nmap is installed, a safe beginner test is scanning localhost:
nmap localhost
That helps you answer:
- which ports are listening?
- are they TCP or UDP?
- which process owns them?
SUID and SGID Files
Some executable files run with the permissions of the file owner or group.
These special mode bits are:
- SUID
- SGID
Why this matters:
- they are sometimes necessary
- they also deserve extra security attention
Find SUID files:
find / -perm -4000 -type f 2>/dev/null
Find SGID files:
find / -perm -2000 -type f 2>/dev/null
You do not panic when you find them. You inspect whether they are expected.
Password Aging
Password aging policies reduce the chance that old credentials stay valid forever.
Useful command:
chage -l <user>
This shows information such as:
- last password change
- minimum days
- maximum days
- warning period
Change password aging:
sudo chage -M 90 -W 7 <user>
The main beginner idea:
passwdchanges the password itselfchagechanges password aging policy
sudo and visudo
Administrative access should be controlled carefully.
Important rules:
- use
sudofor privileged commands - edit sudo policy with
visudo, not a normal editor
Show sudo version and policy basics:
sudo -V
sudo -l
The file you should know:
/etc/sudoers
And often:
/etc/sudoers.d/
Session and Login Inspection
Useful commands:
who
w
last
These answer different questions:
- who is logged in now?
- what are they doing?
- who logged in recently?
This is basic but practical security awareness.
Shell Limits with ulimit
ulimit controls resource limits for the shell and processes started from it.
Show current limits:
ulimit -a
Examples of things limits can affect:
- number of open files
- core dump creation
- process counts
You do not need deep tuning yet. You do need to know that limits are one part of basic system hardening and stability.
A Simple Security Check Routine
On a small Linux host, a sensible routine is:
- inspect listening services
- review privileged access
- inspect password aging
- check current and recent logins
- review SUID and SGID files
That is exactly the kind of practical order LPIC likes.
Practice Step by Step
1) Inspect listening services
- Run:
ss -tuln - If you have
sudo, run:sudo ss -tulpn - Identify one listening service and its port.
2) Inspect password aging
- Run:
sudo chage -l $USER - Note:
- maximum password age
- warning period
3) Review current and past logins
- Run:
who - Then:
w - Then:
last | head - Compare what each command tells you.
4) Find privileged executables
- Run:
find /usr /bin /sbin -perm -4000 -type f 2>/dev/null | head - Then:
find /usr /bin /sbin -perm -2000 -type f 2>/dev/null | head - Notice that special bits are not rare, but they do deserve attention.
Cheat Sheet
ss -tuln
sudo ss -tulpn
nmap localhost
find / -perm -4000 -type f 2>/dev/null
find / -perm -2000 -type f 2>/dev/null
sudo chage -l <user>
sudo chage -M 90 -W 7 <user>
sudo -l
who
w
last
ulimit -a
Test Your Knowledge
Complete the quiz to assess your understanding of this course's concepts.
