nimabibi

nimabibi

Upgrade openssh on CentOS

1. Download Dependencies#

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

2. Download openssh 9.3#

wget -O openssh.tar.gz https://mirrors.aliyun.com/pub/OpenBSD/OpenSSH/portable/openssh-9.3p1.tar.gz

3. Backup Original Configuration File#

cp /etc/ssh/sshd_config sshd_config.backup

4. Remove Old Version#

rpm -e --nodeps `rpm -qa | grep openssh`

5. Extract New Version#

tar -zxvf openssh.tar.gz

6. Compile Configuration#

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

7. Compile and Install#

make && make install

8. Adjust File Permissions#

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

9. Copy Configuration File#

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

10. Restore Original Configuration File#

mv ../sshd.backup /etc/pam.d/sshd

11. Add Auto-Start#

chkconfig --add sshd

12. Restart Service#

systemctl restart sshd

13. Verify the Result#

#openssh version displays 9.3 to indicate success
Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.