查看openSSH版本 ssh 和 sshd 都可以查看openSSH的版本

1
2
3
4
[root@localhost ~] sshd -V
openSSH_9.6p1, OpenSSL 1.1.1p 21 Jun 2022
[root@localhost ~] ssh -V
openSSH_9.6p1, OpenSSL 1.1.1p 21 Jun 2022

查看位置

1
2
3
4
[root@localhost ~] which ssh
/usr/bin/ssh
[root@localhost ~] which sshd
/usr/sbin/sshd

备份原文件

1
2
[root@localhost ~] cp /usr/bin/ssh /usr/bin/ssh.bak
[root@localhost ~] cp /usr/sbin/sshd /usr/sbin/sshd.bak

查找版本号文本

1
2
3
4
5
6
[root@localhost ~] strings /usr/bin/ssh | grep OpenSSH_9.6
OpenSSH_9.6p1
OpenSSH_9.6
[root@localhost ~] strings /usr/sbin/sshd | grep OpenSSH_9.6
OpenSSH_9.6p1
OpenSSH_9.6

修改版本号

1
2
[root@localhost ~] sed -i 's/OpenSSH_9.6/OpenSSH_9.8/g' /usr/sbin/sshd
[root@localhost ~] sed -i 's/OpenSSH_9.6/OpenSSH_9.8/g' /usr/bin/ssh

重新查看openSSH版本

1
2
3
4
[root@localhost ~] sshd -V
openSSH_9.8p1, OpenSSL 1.1.1p 21 Jun 2022
[root@localhost ~] ssh -V
openSSH_9.8p1, OpenSSL 1.1.1p 21 Jun 2022