Security administration tasks
The routine security work of an administrator: auditing who can do what, finding files that grant privilege, limiting what users may consume, and running commands as somebody else without handing out the root password.
Lesson 1 of 3 in objective 110. Security, part of LPIC-1 Exam 102-500.
Auditing the system
find is the audit tool. find / -perm -4000 lists every SUID file — programs that run as their owner — and -perm -2000 lists SGID ones; an unexpected entry is a privilege escalation waiting to happen. find / -nouser -o -nogroup finds files left behind by a deleted account. Open ports are the other half: ss -tulpn, or nmap from another machine, answers what is actually reachable, and lsof -i lists which process holds which network file.
fuser answers the same shape of question about a filesystem rather than a socket, and it is what a umount refusing with "target is busy" is asking for. fuser -m /mnt/data reads the name as a FILESYSTEM — or as the block device backing one — and lists every process using anything on it, which is the point of -m: without it, fuser reports only on that one path. Each PID is marked with the kind of access, c for a current directory, e for a running executable, r for a root directory and m for a mapped file, so the output says why each process is holding the mount rather than only that it is. lsof +D /mnt/data answers the same question by walking the tree. Keep fuser -k for after you have decided those processes may die.
Who is logged in and who has been: w and who show current sessions, last reads /var/log/wtmp for logins and lastb reads /var/log/btmp for failed ones. An account with no password at all is found by scanning the second field of /etc/shadow, and passwd -l or a /usr/sbin/nologin shell is how one gets closed.
Two separate mechanisms in /etc/shadow are both spelled with chage, and the exam turns on telling them apart. PASSWORD AGEING says when the password must be replaced: -M maximum days, -m minimum days, -W the warning window before expiry, -I the inactive grace afterwards. ACCOUNT EXPIRY is a different field and disables the login as a whole whatever state the password is in: chage -E 2026-12-31 bob takes a date in YYYY-MM-DD form, or a count of days since the epoch, and usermod -e writes the same field. So a contractor who must lose access on a known date is -E, and a policy that a password be rotated every ninety days is chage -M 90 alice — for which passwd -x 90 alice is the identical instruction under the other command. Watch the CASE of the flags: -M and -m are maximum and minimum days, and swapping them is the standard distractor. chage -l alice prints the lot in words, which is how you confirm a change landed on the field you meant.
Shutting out EVERYBODY at once, for maintenance, is a different mechanism and a favourite question because it looks like it should be a command. It is a file: create /etc/nologin, and every non-root login is refused, with whatever you put in the file shown to the person turned away. Root is still let in, which is the point — the machine does not lock out the administrator doing the maintenance. Nothing has to be restarted; pam_nologin checks for the file on each login attempt, so the mere existence of it is the switch, and deleting it opens the machine again. shutdown creates and removes it for you as a scheduled shutdown approaches.
The two are worth keeping apart: /usr/sbin/nologin is a SHELL that refuses one account, named in that account's line in /etc/passwd; /etc/nologin is a FILE that refuses everyone. They differ by one slash and one directory and the exam has noticed.
echo "Down for patching until 20:00" > /etc/nologinfrom another terminal, as an ordinary user:Down for patching until 20:00Connection closed by 192.168.1.10 port 22root still gets inrm /etc/nologin
Limits and delegated privilege
/etc/security/limits.conf sets per-user and per-group resource limits — number of processes, open files, maximum memory, maximum logins — enforced by PAM at login. ulimit is the shell's view of the same thing: ulimit -a shows the current set, and a SOFT limit can be raised by the user up to the HARD limit, which only root can raise. That soft/hard distinction is the same idea as in disk quotas and is asked in the same way.
su switches user, and su - additionally runs the target's login scripts so you get their environment rather than yours — the difference is asked directly. sudo runs one command as another user, configured in /etc/sudoers and its drop-in directory /etc/sudoers.d/, and edited with visudo, which validates the syntax before saving; a broken sudoers file locks everybody out, which is why the validating editor exists. sudo logs what was run and by whom, which is the real argument for it over sharing a root password.
Worth carrying in
- find / -perm -4000
- Every SUID file on the system. -2000 for SGID.
- find / -nouser
- Files owned by a UID with no account — the residue of a deleted user.
- ss -tulpn / lsof -i
- What is listening, and which process owns each network connection.
- last / lastb
- Successful logins from
wtmp; failed ones frombtmp. - fuser -m /mnt/data
- Every process holding a busy filesystem, with a letter for the kind of access.
- chage -E date / -M days
- Account expiry versus maximum password age. Two different fields of
/etc/shadow. - /etc/nologin
- A FILE. While it exists, every non-root login is refused and its contents are shown.
- /usr/sbin/nologin
- A
SHELL. Refuses the one account whose/etc/passwdline names it. - /etc/security/limits.conf
- Per-user resource limits applied by PAM at login.
- ulimit -a
- The shell's limits. Soft limits are raisable by the user, hard ones only by root.
- su -
- Switch user AND take their login environment. Plain su keeps yours.
- visudo
- Edit
/etc/sudoerswith syntax validation before it is saved.
What the exam does with this
- su versus su -: the hyphen loads the target user's login environment, including their
PATH. - Always visudo. A syntax error in
/etc/sudoerswritten with a plain editor can lock out every administrator. - Soft limits can be raised by the user up to the hard limit; only root raises a hard limit.
chage -Eends an account on a date;chage -Monly forces the password to be changed. Different fields, different questions./etc/nologinblocks everyone but root and needs no restart;/usr/sbin/nologinis a login shell that blocks one account. One is a file, the other is a shell.
- Objective
- 110. Security
- Share of the exam
- 16.67% (the whole objective)
- Questions in this lesson
- 15
- Signed for by a person
- 0
Partly checked. None of the 15 questions here has been read against the cited source by a person. 15 questions have been checked against their cited clause by an automated pass — which is not the same thing, and is not a signature.
Only questions a person has signed for are used in mock exams here. That is the whole difference between the two kinds of checking above.
How these questions are written — where each question comes from, what the verification ledger records, and what happens when one is found wrong.
Drill this lesson
A lesson is one sitting: the trainer draws a short run from these questions alone and spaces the ones you get wrong.
Practise Security administration tasks
Questions in this lesson
- During an audit you must list every file under /usr that has the set-user-ID bit set, regardless of what its other permission bits are. Which command does that? machine-checked
- You locked the password of the account `intern` and confirmed that its hash in /etc/shadow now begins with an exclamation mark. The intern nevertheless still reaches a shell on the host over SSH, without being prompted for anything. What is going on, and what actually stops it? machine-checked
- You have just been added to a sudo rule on a host and want sudo itself to report which commands you are allowed to run there, without running any of them. Type the complete command. machine-checked
- A daemon started from your bash session keeps hitting a 'too many open files' error. Which command raises the limit on open file descriptors for the current shell and the processes it starts to 4096? machine-checked
- You are about to take a server down for maintenance and want ordinary users refused at login for the next hour, with an explanatory message, while root can still get in. On a system using PAM's pam_nologin, creating which file achieves this? machine-checked
- Which two commands report the users who are logged in right now, rather than a history of past logins? (Choose two.) machine-checked
- Using the iproute2 socket utility, list only listening TCP sockets, with ports and addresses left as numbers rather than resolved to service and host names. Type the complete command, using short options only. machine-checked
- Why is visudo the recommended way to edit /etc/sudoers rather than opening the file directly in an editor? machine-checked
- From your own shell you run `su bob` and it succeeds. Compared with running `su - bob`, what is different about the shell you end up in? machine-checked
- Which two statements about sudo are correct? (Choose two.) machine-checked
- A contractor's account `bob` must be disabled on 31 December 2026, whatever the state of his password on that date. Which command sets that? machine-checked
- `umount /mnt/data` fails with 'target is busy'. Which command lists every process holding a file open anywhere on that mounted filesystem, so you can see who to stop first? machine-checked
- /etc/sudoers contains the line `alice db1 = (postgres) /usr/bin/psql`. What does the word `postgres` in parentheses specify? machine-checked
- You run `nmap 192.0.2.10` as an ordinary user rather than as root, and the output reports a connect scan. Why does nmap not use its usual default scan here? machine-checked
- A new policy requires the password of the existing account `alice` to be replaced at least every 90 days. Which TWO commands set that maximum password age? (Choose two.) machine-checked
Practise Security administration tasks
The rest of objective 110
- Security administration tasks — you are here
- Host security
- Securing data with encryption