Question Bank — Full Coverage
/etc/passwd, /etc/shadow, /etc/group — Deep Structure
- List all 7 fields of
/etc/passwdand explain what each one means. What does anxin the password field indicate? - What are the 9 fields in
/etc/shadow? For each field, state what it controls and what unit it uses. - A user’s
/etc/shadowentry shows!before the password hash. What does this mean, and how did it get there? - What is the difference between UID 0, UIDs 1–999, and UIDs 1000+? Why does this distinction matter?
- A
/etc/passwdline shows/sbin/nologinas the shell. What happens if someone tries to SSH in as that user? What about switching to them withsu? - What is
/etc/gshadow? What does it store that/etc/groupdoes not? - How do you safely edit
/etc/passwdand/etc/sudoers? Why should you never edit them directly with a regular text editor?
Password Aging & Account Expiry
- What does
chage -l usernameshow you? Name every field it outputs. - A user’s password must be changed every 90 days, with a 7-day warning and a 5-day grace period after expiry. Write the exact
chagecommand to configure this. - What is the difference between password expiry and account expiry? Which field in
/etc/shadowcontrols each? - A sysadmin wants to force a user to change their password on their very next login. What is the command? What does it actually write into
/etc/shadow? - You want to disable an account permanently on December 31, 2025. Write the exact
chagecommand. What field does this modify in/etc/shadow? - What is the minimum password age (
chage -m) used for? Give a real-world reason an admin would set it to a non-zero value. - What do fields 4, 5, 6, 7, and 8 in
/etc/shadowmean respectively, in human-readable terms?
Account Locking & Unlocking
- What is the difference between
passwd -l usernameandusermod -L username? Do they achieve the same thing? - How do you unlock a locked account? Give both the
passwdandusermodways. - After locking an account with
passwd -l, what exactly changes in/etc/shadow? Show before and after. - A locked regular account — can root still
suinto it? Can the user still use SSH key authentication to log in? Explain why. - What is
/etc/nologin? What happens when this file exists on the system? Which users are affected and which are not?
sudo — Deep Configuration
- What is
visudoand why must you always use it instead of editing/etc/sudoersdirectly? - Explain this sudoers line completely:
deploy ALL=(www-data) NOPASSWD: /usr/bin/systemctl restart nginx - What are the four parts of a sudoers privilege specification (
who where=(as_whom) commands)? What doesALLmean in each position? - What is the purpose of
/etc/sudoers.d/? How do you add a new sudo rule cleanly without touching/etc/sudoers? - How do you give an entire group sudo access? Write the sudoers line for group
devops. - A user runs
sudo -ivssudo -svssudo su -. What is different about each in terms of environment and shell behavior? - What does
sudo -ldo? What doessudo -lladd? - A sudoers entry uses
%wheel ALL=(ALL:ALL) ALL. What does theALL:ALLpart mean? What does the%prefix mean? - What is a
Cmnd_Aliasin sudoers? Write an example that groupssystemctl,journalctl, andservicetogether, then grant it to a user. - What happens if
/etc/sudoershas a syntax error and you can’t usesudoanymore? How do you recover?
su — Substituting Users
- What is the difference between
su usernameandsu - username? What specifically changes with the dash? - Can a regular user
suto root without knowing root’s password? Under what condition? - What file controls which users are allowed to use
su? What PAM module enforces this? - What does
su -c "command" usernamedo? Give a practical use case.
Groups — Deep Management
- What is the difference between a user’s primary group and supplementary groups? Where is each stored?
- You add a user to a new group with
usermod -aG. Why is the-aflag critical? What happens without it? - After adding yourself to a new group with
usermod -aG, you rungroupsand the new group is not listed. Why? How do you fix it without logging out? - What does
newgrp groupnamedo? What is its limitation? - What is
gpasswdused for? How do you use it to add and remove members from a group? - How do you create a group with a specific GID? Why might you need a specific GID in environments with shared NFS storage?
- A file is owned by group
developersbut a user in that group cannot read it. What are the possible reasons?
Default User Environment — /etc/skel, Profiles
- What is
/etc/skel? When is it used and when is it NOT used? - Explain the difference between
/etc/profile,/etc/bashrc,~/.bash_profile, and~/.bashrc. Which ones run for login shells vs interactive non-login shells? - A sysadmin wants every new user to have a custom
.bashrcwith company aliases pre-configured. What is the correct approach? - What is the difference between a login shell and an interactive non-login shell? Give one example of each.
- Where should system-wide environment variables be defined? What is the purpose of
/etc/environmentvs/etc/profile.d/?
Special & Service Accounts
- What is a system account? How does
useradd -rdiffer fromuseraddwithout-r? - Why do service accounts (nginx, mysql, www-data) typically have
/usr/sbin/nologinor/bin/falseas their shell? What is the difference between those two options? - How do you run a command as a service account (e.g.,
www-data) for debugging purposes if it has no login shell? - What is the purpose of the
nobodyuser? Is it safe to run services asnobody? Explain.
getent — Querying System Databases
- What does
getentdo and why is it more reliable than directlycat-ing/etc/passwd? - What are the four most common databases you’d query with
getent? Write the command for each. - You run
getent passwd usernameand get no output. The user exists in/etc/passwd. What could explain this? - What is
nsswitch.conf? What does the linepasswd: files systemdmean in terms of lookup order?
Login Restrictions & Security Controls
- What is
/etc/security/limits.confused for? Give two practical examples of limits you might set for a production server. - What does the
ulimitcommand do? What is the difference between a hard limit and a soft limit? - How do you restrict SSH access to specific users or groups at the sshd level? Name the four relevant
sshd_configdirectives. - What is
/etc/securetty? What happens if you removetty1from it? - How do you allow a user to have a shell account but prevent them from using cron or at jobs? What files control this?
PAM — Pluggable Authentication Modules (Foundations)
- What is PAM and why does it exist? What problem does it solve compared to each application managing its own authentication?
- Where are PAM configuration files stored? What is the naming convention for per-service configs?
- A PAM configuration file has four management groups. Name them and briefly describe what each handles.
- What do the four PAM control flags mean:
required,requisite,sufficient,optional? Explain how they differ when a module fails. - What does
pam_tally2orpam_faillockdo? What is the practical security purpose? - A user is locked out due to failed login attempts enforced by PAM. How do you unlock them? Write the command.
Practical Scenario Questions
- You need to create a deployment user with these requirements: no login shell, member of
www-dataanddeploygroups, home directory at/var/deploy, locked password. Write all the commands. - A junior developer needs to run
systemctl restart myappandjournalctl -u myappwith sudo but nothing else. Write the complete sudoers configuration. - You suspect a user account has been compromised. List the steps you’d take immediately — checking account status, active sessions, and locking the account — with exact commands.
- A new policy requires all user passwords to expire every 60 days with a 7-day warning. You need to apply this to all existing human users (UID ≥ 1000) at once. How do you approach this?
- After running
id username, you see the user’s primary group isusername(their own private group) but they should be usingengineersas their primary group. Fix this with one command. - You create a new file as user
alice(primary groupalice). A colleague in groupengineerscannot read it even thoughaliceis also inengineers. Explain this and show how to fix it without changing permissions on the file.
Total: 70 questions. Anyone who can answer all of these clearly — without looking things up — has a solid, practical Round 2 foundation in Domain 2.