当只能通过SSH远程链接服务器时,要防止ssh断开,避免安装失误无法控制服务器;
使用putty可以通过设置Seconds between keepaliaves为60防止自动断开;
$ openssl version
$ ssh -V
centos7.3——OpenSSL1.0.2升级到OpenSSL 1.1.1.
yum -y install pam-devel
$ wget https://mirrors.aliyun.com/openssh/portable/openssh-9.2p1.tar.gz
$ tar zxvf openssh-9.2p1.tar.gz
$ mkdir -p ~/ssh_bak/etc/ssh/ && mkdir -p ~/ssh_bak/usr/bin/ && mv /etc/ssh/ ~/ssh_bak/etc/ssh/ && mv /usr/bin/{ssh*,scp,sftp} ~/ssh_bak/usr/bin/
$ cd openssh-9.2p1
$ ./configure --prefix=/usr/ --sysconfdir=/etc/ssh --with-ssl-dir=/usr/local/openssl --with-pam --with-md5-passwords --with-selinux && make -j 4 && make install
$ echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config
$ echo 'UsePAM yes' >> /etc/ssh/sshd_config
$ ssh -V
$ systemctl enable sshd
$ systemctl restart sshd
···bash
$ systemctl status sshd
···