防止 SSH 公布其版本号
这是我正在做的事情
cp /usr/sbin/sshd /tmp
ksh -o vi
cd /tmp
strings -t d -a -n 7 sshd | grep -i openssh
在我得到这个输出之后
149143 0@openssH
244802 OPENSSHI
244972 openssh-H9
496496 OpenSSH_7.6p1 Ubuntu-4ubuntu0.7
499144 [email protected],[email protected],[email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa
499440 [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
499552 [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
500399 OpenSSH_7.6p1
500624 OpenSSH_7.6
501314 none,[email protected]
501504 [email protected]
511114 [email protected]
511283 [email protected]
511361 [email protected]
511390 [email protected]
511501 [email protected]
512112 [email protected]
512840 [email protected]
512984 [email protected]
522092 [email protected]
522944 [email protected]
538476 [email protected]
538501 [email protected]
538522 [email protected]
538543 [email protected]
543975 openssh-key-v1
544186 [email protected]
544224 [email protected]
544944 -----BEGIN OPENSSH PRIVATE KEY-----
544984 -----END OPENSSH PRIVATE KEY-----
545104 [email protected]
545144 [email protected]
545192 [email protected]
545240 [email protected]
547288 [email protected]
553384 [email protected]
557682 [email protected]
557705 [email protected]
557728 [email protected]
557760 OpenSSH-2.0*,OpenSSH-2.1*,OpenSSH_2.1*,OpenSSH_2.2*
558192 OpenSSH_2.5.0p1*,OpenSSH_2.5.1p1*
558232 OpenSSH_2.5.0*,OpenSSH_2.5.1*,OpenSSH_2.5.2*
558280 OpenSSH_2.*,OpenSSH_3.0*,OpenSSH_3.1*
559218 OpenSSH_2.3.0*
559233 OpenSSH_2.3.*
559247 OpenSSH_2.5.3*
559262 OpenSSH_3.*
559287 OpenSSH_4*
559298 OpenSSH_5*
559309 OpenSSH_6.6.1*
559324 OpenSSH_6.5*,OpenSSH_6.6*
559350 OpenSSH*
567968 [email protected]
567988 [email protected]
568009 [email protected]
568035 [email protected]
568064 [email protected]
568094 [email protected]
568124 [email protected]
568149 [email protected]
568177 [email protected]
568201 [email protected]
496496 OpenSSH_7.6p1 Ubuntu-4ubuntu0.7
我在客户端获取输出版本
我不知道如何编辑这个,实际上我对这个环境还不熟悉。有人可以指导我编辑这个吗?谢谢
答案1
答案2
我认为您可以使用命令:“sudo sed -i 's/OpenSSH_7.6p1/OpenSSH_8.4/g' /usr/sbin/sshd ; sudo service sshd restart”来更改版本并重新启动 sshd 服务以使其生效。另外,建议在编辑文件之前备份 sshd 文件。