Cenos openssh升级到8.4版本

1首先查看SSH版本
ssh -V

2 yum安装依赖包
yum -y install gcc gcc-c++ kernel-devel

3 下载安装包
zlib:wget http://www.zlib.net/zlib-1.2.11.tar.gz
openssl:wget https://www.openssl.org/source/openssl-1.1.1h.tar.gz
openssh:wget http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-8.4p1.tar.gz

4 解压安装包
tar xf openssh-8.4p1.tar.gz
tar xf openssl-1.1.1h.tar.gz
tar xf zlib-1.2.11.tar.gz

5 安装zlib
cd zlib-1.2.11/
./configure --prefix=/usr/local/zlib && make -j 4 && make install

6 安装openssl
cd openssl-1.1.1h/
./config --prefix=/usr/local/ssl -d shared

make -j 4 && make install

echo ‘/usr/local/ssl/lib’ >> /etc/ld.so.conf
ldconfig -v

7 安装openssh

mv /etc/ssh /etc/ssh.bak
cd /openssh-8.4p1/
./configure --prefix=/usr/local/openssh --sysconfdir=/etc/ssh --with-ssl-dir=/usr/local/ssl --with-zlib=/usr/local/zlib
make -j 4 && make install

8 sshd_config文件修改

cho ‘PermitRootLogin yes’ >> /etc/ssh/sshd_config
echo ‘PubkeyAuthentication yes’ >> /etc/ssh/sshd_config
echo ‘PasswordAuthentication yes’ >> /etc/ssh/sshd_config

9 备份
mv /usr/sbin/sshd /usr/sbin/sshd.bak
cp -rf /usr/local/openssh/sbin/sshd /usr/sbin/sshd
mv /usr/bin/ssh /usr/bin/ssh.bak
cp -rf /usr/local/openssh/bin/ssh /usr/bin/ssh
mv /usr/bin/ssh-keygen /usr/bin/ssh-keygen.bak
cp -rf /usr/local/openssh/bin/ssh-keygen /usr/bin/ssh-keygen

10 启动
systemctl start sshd
如果启动不了
systemctl stop ssh.service
rm -rf /lib/systemd/system/sshd.service
systemctl daemon-reload
cp /usr/local/src/openssh-8.4p1/contrib/redhat/sshd.init /etc/init.d/sshd
/etc/init.d/sshd restart
systemctl status sshd

添加开机启动

chkconfig --add sshd

chkconfig --list sshd

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值