Topic 713: Basic BSD System Administration
This topic focuses on managing user accounts and groups, automating tasks with cron and periodic scripts, maintaining system time, handling system logging, basics of Mail Transfer Agents (MTAs), printing, and managing user sessions.
713.1: Manage User Accounts and Groups
-
FreeBSD:
pw adduser bob -m -s /bin/sh passwd bob rmuser bob
-
OpenBSD/NetBSD:
useradd -m -s /bin/ksh alice passwd alice userinfo alice userdel alice
-
Check user info:
id alice
-
Manage groups:
-
Typically by editing
/etc/group
or using commands likeusermod
. -
Example:
usermod -G newgroup alice
-
Typically by editing
-
vipw: Safely edits
/etc/passwd
(and/etc/shadow
on some systems). - chpass: Changes password configurations for a user account.
- chfn: Change finger information.
- /usr/share/skel: Represents the new user's home layout.
713.2: Automate System Administration Tasks by Scheduling Jobs
-
Edit user crontab:
crontab -e
-
Example (run
backup.sh
at 3:15 AM daily):15 3 * * * /home/user/backup.sh
-
List user crontab:
crontab -l
-
Cron allow/deny:
-
/var/cron/allow
-
/var/cron/deny
-
Periodic Scripts
-
FreeBSD:
periodic daily periodic weekly periodic monthly /etc/defaults/periodic.conf
-
NetBSD:
/etc/daily.conf
,/etc/weekly.conf
,/etc/monthly.conf
-
OpenBSD:
/etc/daily
,/etc/weekly
,/etc/monthly
713.3: Maintain System Time
-
Check current time:
date
-
Set system time (e.g., 2025-01-27 12:00):
date 202501271200
-
NTP:
-
FreeBSD/NetBSD:
ntpd -c /etc/ntp.conf ntpq -p
-
OpenBSD:
ntpd -f /etc/ntpd.conf
-
FreeBSD/NetBSD:
713.4: System Logging
-
Common log files under
/var/log
(e.g.,/var/log/messages
). -
Check logs:
tail -f /var/log/messages
-
Rotate logs:
-
newsyslog
-
Configure in
/etc/newsyslog.conf
-
713.5: Mail Transfer Agents (MTA) Basics
-
Sendmail:
mailq sendmail -q
-
Postfix:
mailq postqueue -f
-
OpenSMTPD (OpenBSD):
smtpctl show queue smtpctl flush queue
-
Aliases in
/etc/mail/aliases
, then:newaliases
- Relay configuration: Depends on MTA.
713.6: Manage Printing and Print Jobs
-
Common BSD printing commands:
lpc # manage printer daemons and queues lpq # list jobs lprm # remove jobs
-
Configuration in
/etc/printcap
.
713.7: Manage User Sessions
-
Show who's logged in:
w who users
-
History of logins:
last
-
FreeBSD/NetBSD:
lastlogin
-
Log file:
/var/log/lastlog