ssh -V
输出示例:
OpenSSH_8.2p1 Ubuntu-4ubuntu0.4, OpenSSL 1.1.1f 31 Mar 2020
bash
apt show openssh-client
bash
yum info openssh-clients
bash
pacman -Qi openssh
telnet 服务器IP 22
# 或
nc 服务器IP 22
输出示例:
SSH-2.0-OpenSSH_7.9p1 Debian-10+deb10u2
nmap -sV -p 22 服务器IP
查看SSH服务器配置文件:
sudo cat /etc/ssh/sshd_config | grep Protocol
常见设置:
- Protocol 2
(仅使用SSH-2)
- Protocol 1,2
(同时支持SSH-1和SSH-2,不建议)
Protocol 2
sudo apt update
sudo apt upgrade openssh-server openssh-client
sudo yum update openssh-server openssh-clients
wget https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-9.0p1.tar.gz
tar -xzf openssh-9.0p1.tar.gz
cd openssh-9.0p1
./configure
make
sudo make install
修改配置或升级后,重启SSH服务:
sudo systemctl restart sshd
然后重新检查版本确认变更已生效。