Administrative Tasks
What the exam tests
Administrative Tasks covers account and group management, job scheduling with cron, anacron, and systemd timers, and localization and time-zone configuration. Expect file-format and command-option questions.
Core rules
- User database:
/etc/passwdfields are name:password-placeholder:UID:GID:GECOS:home:shell;/etc/shadowstores hashes and aging;/etc/groupand/etc/gshadowstore groups.useradd -m -s /bin/bash -G sudo alice,usermod -aG,userdel -r,groupadd,passwd, andchage -lare core commands. - Defaults live in
/etc/default/useradd,/etc/login.defs, and/etc/skel.adduseris a distro-friendly wrapper;useraddis lower level. - cron uses five fields: minute, hour, day-of-month, month, day-of-week. In
/etc/crontaband/etc/cron.d/*a user field follows; personal crontabs omit it and are edited withcrontab -e, listed with-l, removed with-r.@rebootruns at boot. anacron runs missed jobs on systems not always on; systemd timers use a.timerplus.service. - Locale:
LANG,LC_*, andLC_ALL; uselocale,localectl, andlocaledef. Time zone:timedatectl set-timezone,/etc/timezone, and/etc/localtimeas a symlink to/usr/share/zoneinfo/....
Worked example
Run /usr/local/bin/rotate at 02:30 on weekdays as root:
30 2 * * 1-5 root /usr/local/bin/rotate
Reasoning: field 1 is minute 30, field 2 hour 2, * every day-of-month, * every month, and 1-5 Monday through Friday. In /etc/crontab the user field is required; in a personal crontab it is omitted. The script should use absolute paths because cron's PATH is minimal.
Traps
crontab -r removes the whole crontab without confirmation. % in a crontab command is special unless escaped. The day-of-month and day-of-week fields are ORed when both are restricted. usermod -G replaces supplementary groups; use -aG. Deleting a user without -r leaves the home directory. LC_ALL overrides all other locale variables. Setting the clock manually with timedatectl may conflict with a running NTP service; disable synchronization first.