openssh频繁的爆出漏洞,现在的yum源版本都太低所以yum更新是没用的,只有去官网下载最新版本进行编译安装升级。
安装依赖包
yum -y install telnet telnet-server openssl openssl-devel zlib zlib-devel pam-devel
配置telnet服务以便于卸载老版本ssh后远程连接。
vim /etc/xinetd.d/telnet
disable = yes
改成
disable = no
vim /etc/securetty
加入
pts/0
pts/1
pts/2
pts/3
启动telnet服务。
service xinetd start
退出ssh连接使用telnet远程服务器。
先查看都安装了那些openssh包,然后卸载老版本。
rpm -qa|grep openssh
rpm -e openssh --nodeps
rpm -e openssh-server --nodeps
rpm -e openssh-clients --nodeps
rpm -e openssh-askpass --nodeps
编译安装openssh
tar zxvf openssh-7.2p1.tar.gz
cd openssh-7.2p1
./configure --prefix=/usr --sysconfdir=/etc/ssh --with-zlib --with-ssl --with-md5-passwords --mandir=/usr/share/man --with-pam
make && make install
复制启动文件到/etc/init.d
cp contrib/redhat/sshd.init /etc/init.d/sshd
chmod +x /etc/init.d/sshd
chkconfig –add sshd
配置允许root登陆
vim /etc/ssh/sshd_config
添加以下参数:
PermitRootLogin yes
启动sshd服务
service sshd start
查看版本
ssh -V
登陆测试。