「最小化服務」是伺服器安全加固鐵律:僅運行業務必需服務,關閉其餘服務可釋放資源、減少攻擊面。
chkconfig --list | grep "3:on"
systemctl list-unit-files --type=service | grep enabled
| 系統類型 | 指令 | 範例 |
|---|---|---|
| SysV init | chkconfig service_name off | chkconfig httpd off |
| systemd | systemctl disable service_name | systemctl disable httpd |
| 系統類型 | 指令 |
|---|---|
| SysV init | service httpd stop |
| systemd | systemctl stop httpd |
ps -p 1 -o comm=
# 輸出 systemd → systemd 系統
# 輸出 init → SysV init 系統
gdm, lightdm (伺服器無需桌面)cupssmb, nmb (無 Windows 互存需求)postfix, sendmail (非郵件伺服器)bluetoothavahi-daemon警告:關閉前確認業務不依賴該服務,建議先在測試環境驗證。