码迷,mamicode.com
首页 > 其他好文 > 详细

Openssh升级8.6

时间:2021-06-10 18:51:19      阅读:0      评论:0      收藏:0      [点我收藏+]

标签:syn   res   ini   $?   安装   解压   start   local   kconfig   

1.下载tar包并安装依赖、解压

cd /opt &&  wget http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-8.6p1.tar.gz

yum install -y gcc zlib-devel openssl-devel  pam-devel libselinux-devel 

tar xf /opt/openssh-8.6p1.tar.gz   &&  rm -f openssh-8.6p1.tar.gz

chmod -R  root.root openssh-8.6p1

2.备份

rsync -av  /etc/ssh /etc/ssh.bak
rsync -av  /usr/bin/ssh /usr/bin/ssh.bak
rsync -av  /usr/sbin/sshd /usr/sbin/sshd.bak
rsync -av /etc/ssh/ssh_config /etc/ssh/ssh_config.d    ~/
rsync -av /etc/crypto-policies/back-ends/openssh.config   ~/
rsync -av /etc/ssh/sshd_config  ~
rsync -av ~/.ssh/authorized_keys   ~/.ssh/authorized_keys.bak

3. 编译并安装

cd openssh-8.6p1/

./configure --prefix=/usr --sysconfdir=/etc/ssh --with-md5-passwords --with-pam --with-zlib --with-tcp-wrappers --with-ssl-dir=/usr/local/ssl --without-hardening

echo $?   #如果为0,则成功

make && make install

echo $?   #如果为0,则成功

chmod 600 /etc/ssh/ssh_host_rsa_key /etc/ssh/ssh_host_ecdsa_key /etc/ssh/ssh_host_ed25519_key

#修改配置文件
rsync -av  ~/ssh_config   /etc/ssh/ssh_config

rsync -av   ~/ssh_config.d   /etc/ssh/ssh_config.d

rsync -av  ~/sshd_config   /etc/ssh/sshd_config


cp -a contrib/redhat/sshd.init  /etc/init.d/sshd

cp -a contrib/redhat/sshd.pam /etc/pam.d/sshd.pam

chmod u+x /etc/init.d/sshd

mv /usr/lib/systemd/system/sshd.service /usr/lib/systemd/system/sshd.service.bak

4. 加入开机自启

chkconfig --add sshd
chkconfig sshd on
systemctl daemon-reload
systemctl restart sshd

5.验证

ssh -V

Openssh升级8.6

标签:syn   res   ini   $?   安装   解压   start   local   kconfig   

原文地址:https://www.cnblogs.com/fangweiming/p/14871427.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!