This episode configures essential operational services: OpenSSH with setup-sshd and sshd_config hardening, time synchronization with chrony, and logging with BusyBox syslog and logrotate. You'll also learn to restrict root access and use SSH keys.

These three services may seem trivial, but they're the operational backbone of any server: SSH for remote access, time synchronization so logs and certificates stay consistent, and logging to record what happens. Episode 9 configures all three the Alpine way.
In episode 3, the setup-alpine wizard already offered OpenSSH and NTP. This episode goes deeper: securing sshd_config, using chrony as a modern NTP, and setting up log rotation so the disk doesn't fill up.
OpenSSH is available in the main repository and is usually already installed. If not, install and enable it:
apk add openssh
setup-sshd openssh
rc-service sshd start
rc-update add sshd defaultsetup-sshd openssh configures the SSH server, and rc-update add sshd default makes sure it runs at boot. Check the status and listener port:
rc-service sshd status
ss -tlnp | grep sshdThe ss -tlnp | grep sshd output shows the sshd service listening on port 22.
The main configuration file lives at /etc/ssh/sshd_config. Apply the following basic hardening:
PermitRootLogin no
PasswordAuthentication no
PubkeyAuthentication yes
MaxAuthTries 3
LoginGraceTime 20
AllowUsers armanExplanation:
PermitRootLogin no forbids logging in directly as root.PasswordAuthentication no only allows SSH keys.MaxAuthTries 3 limits password attempts.AllowUsers arman restricts which users may log in.After editing the file, validate the configuration then restart:
sshd -t
rc-service sshd restartsshd -t checks the configuration syntax before it's applied. Don't forget to prepare an SSH key on the client:
ssh-keygen -t ed25519
ssh-copy-id -i ~/.ssh/id_ed25519.pub arman@serverBefore closing your current session, open a new one and test logging in with the key — don't lock yourself out.
Alpine uses chrony as a modern NTP client-server. Install and enable it:
apk add chrony
rc-service chronyd start
rc-update add chronyd defaultCheck time synchronization:
chronyc tracking
chronyc sources
dateThe chronyc tracking output shows the synchronization status, and chronyc sources shows the NTP servers in use. The NTP server configuration lives in /etc/chrony/chrony.conf:
pool 3.id.pool.ntp.org iburst
makestep 1 3makestep 1 3 allows time to step during the first three cycles, useful on a freshly booted VM.
Alpine uses syslog from BusyBox by default, writing to /var/log/messages. For better log management, add logrotate:
apk add logrotate
rc-service syslog start
rc-update add syslog defaultLog rotation configuration lives in /etc/logrotate.conf:
/var/log/messages {
weekly
rotate 4
compress
missingok
}Run logrotate manually to test:
logrotate -d /etc/logrotate.conf
logrotate -f /etc/logrotate.conflogrotate -d /etc/logrotate.conf runs a dry-run, while -f forces rotation. To read logs in real time:
tail -f /var/log/messagesIn episode 13, this log-checking habit becomes part of the security hardening routine.
Tip
Time synchronization isn't a formality: TLS certificates, Kerberos authentication, and log rotation all depend on an accurate clock. Make sure chronyd is running before installing other services.
Episode 9 configured three essential operational services: OpenSSH with sshd_config hardening, chrony for time synchronization, and BusyBox syslog with logrotate for log management.
Key takeaways:
sshd -t validates the configuration before a restart.In the next episode, episode 10, we'll cover firewalls with iptables and nftables — using setup-firewall, writing nft rules with input, forward, and output chains, and building NAT and IP forwarding for a router or gateway.