openssh升级到8.3版本历史留存

   rpm -qa |grep openssh
   vi /etc/ssh/sshd_config    PasswordAuthentication yes   PermitRootLogin yes
   systemctl restart sshd
   
   安装telnet服务,可以直接用telnet ip  登录机器 (必须用普通用户)
   防止ssh升级不可用无法登录机器
   yum install -y telnet-server
   yum install -y xinetd
   systemctl start telnet.socket
   systemctl start xinetd
   echo 'pts/0' >>/etc/securetty
   echo 'pts/1' >>/etc/securetty
   systemctl restart telnet.socket
   yum install telnet.x86_64
   exit
   useradd test
   passwd test
   exit
   找一个其他机器测试telnet ip 能否正常登录
   
   下载openssl-8.3安装包
   cd /home/
   ll
   mkdir sshpackage
   cd sshpackage/
   ll
   wget http://www.zlib.net/zlib-1.2.11.tar.gz
   wget https://www.openssl.org/source/openssl-1.1.1g.tar.gz
   wget http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-8.3p1.tar.gz
   ls -l
   rm -f openssh-8.3p1.tar.gz
   ll
   rz
   ll
   
   解压编译zlib-1.2.11
   tar zxf zlib-1.2.11.tar.gz 
   ll
   cd zlib-1.2.11/
   ./configure --prefix=/usr/local/zlib
   make && make install
   
   解压编译openssl-1.1.1g
   tar -xvf openssl-1.1.1g.tar.gz
   cd ..
   ll
   tar -xvf openssl-1.1.1g.tar.gz
   cd openssl-1.1.1g/
   ./config --prefix=/usr/local/ssl -d shared
   make && make install
   echo '/usr/local/ssl/lib' >> /etc/ld.so.conf
   ldconfig -v 
   cd ..
   
   解压编译openssh-8.3p1
   tar -xvf openssh-8.3p1.tar.gz
   cd openssh-8.3p1/
   ./configure --prefix=/usr/local/openssh --with-ssl-dir=/usr/local/ssl --with-zlib=/usr/local/zlib
   make && make install
   
   修改配置
   vi  /usr/local/openssh/etc/sshd_config   PasswordAuthentication yes   PermitRootLogin yes
   
   备份升级替换ssh
   mv /etc/ssh/sshd_config /etc/ssh/sshd_config.bak
   cp /usr/local/openssh/etc/sshd_config /etc/ssh/sshd_config
   mv /usr/sbin/sshd /usr/sbin/sshd.bak
   cp /usr/local/openssh/sbin/sshd /usr/sbin/sshd
   mv /usr/bin/ssh /usr/bin/ssh.bak
   cp /usr/local/openssh/bin/ssh /usr/bin/ssh
   mv /usr/bin/ssh-keygen /usr/bin/ssh-keygen.bak
   cp /usr/local/openssh/bin/ssh-keygen /usr/bin/ssh-keygen
   mv /etc/ssh/ssh_host_ecdsa_key.pub /etc/ssh/ssh_host_ecdsa_key.pub.bak
   cp /usr/local/openssh/etc/ssh_host_ecdsa_key.pub /etc/ssh/ssh_host_ecdsa_key.pub
   systemctl restart sshd
   ssh -V
   
   一切正常后重新登录 关闭telnet服务
   systemctl stop telnet.socket
   systemctl stop xinetd


猜你喜欢

转载自blog.51cto.com/superleedo/2535233