当前位置:网站首页>Cenos openssh upgrade to version 8.4

Cenos openssh upgrade to version 8.4

2022-07-07 12:08:00 Chenjijjn

1 First of all to see SSH edition
ssh -V

2 yum Install dependency packages
yum -y install gcc gcc-c++ kernel-devel

3 Download installation package
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 Unzip the installation package
tar xf openssh-8.4p1.tar.gz
tar xf openssl-1.1.1h.tar.gz
tar xf zlib-1.2.11.tar.gz

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

6 install 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 install 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 File modification

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

9 Backup
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 start-up
systemctl start sshd
If it doesn't start
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

Add startup

chkconfig --add sshd

chkconfig --list sshd

原网站

版权声明
本文为[Chenjijjn]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202130619121236.html

随机推荐