nimabibi

nimabibi

CentOSのopensshのアップグレード

1. ディペンデンシーのダウンロード#

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

2. openssh9.3 のダウンロード#

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

3. 元の設定ファイルのバックアップ#

cp /etc/ssh/sshd_config sshd_config.backup

4. 古いバージョンの削除#

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

5. 新しいバージョンの解凍#

tar -zxvf openssh.tar.gz

6. コンパイルと設定#

./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. コンパイルとインストール#

make && make install

8. ファイルのパーミッションの調整#

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

9. 設定ファイルのコピー#

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

10. 元の設定ファイルの復元#

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

11. 自動起動の追加#

chkconfig --add sshd

12. サービスの再起動#

systemctl restart sshd

13. 結果の検証#

#opensshのバージョンが9.3と表示されれば成功です
読み込み中...
文章は、創作者によって署名され、ブロックチェーンに安全に保存されています。