阿里云CentOS升级SSH到8.2版本
1、下载文件并解压:
cd /data
mkdir openssh
http://www.zlib.net/zlib-1.2.11.tar.gz
https://www.openssl.org/source/openssl-1.1.1g.tar.gz
https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-8.2p1.tar.gz
tar --no-same-owner -zxf zlib-1.2.11.tar.gz
tar --no-same-owner -zxf openssl-1.1.1g.tar.gz
tar --no-same-owner -zxf openssh-8.2p1.tar.gz
2、安装更新:
yum -y update openssh
yum -y install wget tar gcc make
3、安装zlib:
cd zlib-1.2.11
./configure --prefix=/usr/local/zlib
make && make install
4、安装openssl:
cd ../
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
5、安装openssh:
cd ../
cd openssh-8.2p1
./configure --prefix=/usr/local/openssh --with-zlib=/usr/local/zlib --with-ssl-dir=/usr/local/ssl
make && make install
6、移除以前安装的老版本:
yum remove openssh
7、更新配置信息
vim /usr/local/openssh/etc/sshd_config
添加:
PermitRootLogin yes
PubkeyAuthentication yes
PasswordAuthentication yes
8、复制并配置参数
cp /data/openssh/openssh-8.2p1/contrib/redhat/sshd.init /etc/init.d/sshd
chkconfig --add sshd
cp /usr/local/openssh/etc/sshd_config /etc/ssh/sshd_config
cp /usr/local/openssh/sbin/sshd /usr/sbin/sshd
cp /usr/local/openssh/bin/ssh /usr/bin/ssh
cp /usr/local/openssh/bin/ssh-keygen /usr/bin/ssh-keygen
cp /usr/local/openssh/etc/ssh_host_ecdsa_key.pub /etc/ssh/ssh_host_ecdsa_key.pub
9、设置开机启动:
service sshd restart
systemctl restart sshd.service
systemctl status sshd.service
systemctl enable sshd.service
sshd -t
10、设置远程ssh访问:
yum install openssh-server