Ubuntu Minimal 是一个轻量级的 Ubuntu 版本,它只包含最基本的系统工具和应用程序,非常适合需要最小化系统资源占用的用户,如服务器、物联网设备或开发者。然而,正因为其简洁性,Ubuntu Minimal 也需要用户特别注意安全防护措施,以确保系统的安全性和稳定性。以下是一些关键的安全防护措施:
sudo apt update
sudo apt upgrade -y
/etc/login.defs 文件,设置密码的最长使用天数、最短使用天数、到期警告天数和最小间隔时间。/etc/pam.d/system-auth 文件中添加如下配置,确保密码复杂度:password requisite pam_cracklib.so retry=3 dcredit=-1 lcredit=-1 ucredit=-1 ocredit=-1 minlen=10
sudo apt install ufw -y
sudo ufw enable
sudo ufw allow 22/tcp # 允许 SSH 端口
/etc/ssh/sshd_config 文件,将以下配置设置为 no:PermitRootLogin no
PasswordAuthentication no
/root/.ssh/authorized_keys 文件中。sudo passwd -dl 用户名
rsync 或 duplicity 定期备份重要数据,以防数据丢失或损坏。logwatch 或 fail2ban 监控系统日志,及时发现异常行为或攻击。通过上述措施,可以显著提高 Ubuntu 系统的安全性,保护系统和数据不受未经授权的访问和攻击。