避免SSH Daemon泄露Ubuntu版本

2021-12-26

Ubuntu默认向SSH客户端公布操作系统及其版本 例如Ubuntu-4ubuntu0.3

debug1: Remote protocol version 2.0, remote software version OpenSSH_8.2p1 Ubuntu-4ubuntu0.3

检查DebianBanner设置 如果DebianBanner已设置为no,则无需进一步操作。

grep -i 'DebianBanner' /etc/ssh/sshd_config

编辑 /etc/ssh/sshd_config

echo 'DebianBanner no' | sudo tee -a /etc/ssh/sshd_config

重启OpenSSH Daemon

sudo systemctl restart ssh

修改后再运行 ssh -v hostname 会发现操作系统信息已隐去

debug1: Remote protocol version 2.0, remote software version OpenSSH_8.2p1