# CentOS升级OpenSSH版本
参考文档:
# 网络相关
Centos安装telnet服务
sudo yum -y install telnet*
systemctl start xinetd.service
systemctl start telnet.socket
systemctl enable xinetd.service #开机启动
systemctl enable telnet.socket #开机启动修改telnet server端口
修改/usr/lib/systemd/system/telnet.socket中的stream端口
在防火墙处也打开该端口。
systemctl daemon-reload安装OpenSSH的依赖包
yum install -y gcc gcc-c++ glibc make autoconf openssl openssl-devel pcre-devel pam-devel zlib* pam*
将OpenSSH p版本 (opens new window)的放到服务器,进行编译。注意OpenSSH版本如果不带p则只是OpenBSD使用。
sudo ./configure --prefix=/usr/local/openssh --sysconfdir=/etc/ssh --with-pam --with-ssl-dir=/usr/local/openssl --with-md5-passwords --mandir=/usr/share/man --with-zlib=/usr/local/zlib
sudo make
sudo yum remove openssh-*
sudo chmod 600 /etc/ssh/ssh_host*
sudo make install复制相应文件
sudo cp ./contrib/redhat/sshd.init /etc/init.d/sshd
sudo chkconfig --add sshd
sudo cp /usr/local/openssh/sbin/sshd /usr/sbin/sshd
sudo cp /usr/local/openssh/bin/ssh /usr/bin/ssh
sudo cp /usr/local/openssh/bin/ssh-keygen /usr/bin/ssh-keygen添加服务
service sshd restart
systemctl start sshd.service
systemctl enable sshd.service
sshd -t