#爲防止重啓sshd失敗連不上機器,先用telnet連上服務器
安裝telnet
yum install -y telnet telnet-server xinetd ,離線情況下去rpmfind網站下載這三個rpm,yum install *.rpm -y 安裝
增加配置文件: cat > /etc/xinetd.d/telnet<<EOF
service telnet
{
flags = REUSE
socket_type = stream
wait = no
user = root
server =/usr/sbin/in.telnetd
log_on_failure += USERID
disable = no
}
EOF
啓動:systemctl start xinetd
開機啓動:systemctl enable xinetd
驗證:從其他機器telnet 本機ip ,輸入用戶名密碼能連上,或者crt通過telnet方式能連上
升級ssh:
以下操作用root執行,需要環境支持gcc,最好有yum源
#上傳openssh-7.9p1.tar.gz和openssh-7.9p1-security_fix-1.patch到/root目錄
安裝包和補丁下載地址:http://www.linuxfromscratch.org/blfs/view/svn/postlfs/openssh.html
mkdir /usr/openssh-7.9
cd /root
tar -xzvf openssh-7.9p1.tar.gz
#打補丁
cd openssh-7.9p1
patch -p1 < ../openssh-7.9p1-security_fix-1.patch
#編譯安裝
./configure \
--prefix=/usr/openssh-7.9 \
--sysconfdir=/etc/ssh
make
make install
替換下舊文件
mkdir /tmp/ssh_old
var=($(ls /usr/openssh-7.9/bin/))
for i in ${var[*]};do mv /usr/bin/$i /tmp/ssh_old/;done
cp -a /usr/openssh-7.9/bin/* /usr/bin/
cp -a /usr/openssh-7.9/sbin/sshd /usr/sbin/
#重啓服務
service sshd restart
用ssh能連上服務器說明升級成功
ssh升級好了後,卸載telnet,畢竟明文傳輸,不安全 yum remove telnet