你是想问 如何配置 Debian(或基于 Debian 的衍生系统,比如 Ubuntu / 深度 / Kali 等),还是特指 SED Debian(Security Enhanced Debian,或某个定制版)?
下面我分两种情况说明,你看看哪一个是你需要的。
DHCP(自动获取 IP)
sudo systemctl enable networking
sudo systemctl start networking
静态 IP(Debian 12 推荐使用 netplan 或 /etc/network/interfaces)
sudo nano /etc/network/interfaces
示例:
auto eth0
iface eth0 inet static
address 192.168.1.100
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 8.8.8.8
重启网络:
sudo systemctl restart networking
sudo nano /etc/apt/sources.list
国内常用(清华源):
deb https://mirrors.tuna.tsinghua.edu.cn/debian bookworm main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main
更新:
sudo apt update
sudo apt upgrade
adduser yourname
usermod -aG sudo yourname
sudo apt install openssh-server
sudo systemctl enable ssh
sudo systemctl start ssh
sudo apt install ufw
sudo ufw allow 22
sudo ufw enable
如果你指的是 SED = Security-Enhanced Debian,一般配置会额外包括:
Debian 默认用 AppArmor:
sudo apt install apparmor apparmor-utils
sudo systemctl enable apparmor
sudo apt install lynis
sudo lynis audit system
sudo nano /etc/ssh/sshd_config
建议:
PermitRootLogin no
PasswordAuthentication no
你可以直接告诉我:
我可以给你 一步步命令级配置方案。