# openssh升级记录
# 下载openssh源码包
wget https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-9.8p1.tar.gz
# 备份
mv /etc/ssh /etc/ssh_old.bak
mv /usr/bin/ssh /usr/bin/ssh_old.bak
mv /usr/bin/ssh-keygen /usr/bin/ssh-keygen_old.bak
mv /usr/sbin/sshd /usr/sbin/sshd_old.bak
# 卸载旧版本的openssh
rpm -e --nodeps `rpm -qa | grep openssh`
# 解压
tar xf openssh-9.8p1.tar.gz
cd openssh-9.8p1/
# 安装依赖
yum install pam-devel
# 进行编译
./configure --prefix=/usr/local/openssh9p8 --sysconfdir=/etc/ssh --with-pam --with-zlib
make -j4
make install
/usr/local/openssh9p8/sbin/sshd -t -f /etc/ssh/sshd_config
cp /usr/local/openssh9p8/sbin/sshd /usr/sbin/sshd
cp /usr/local/openssh9p8/bin/ssh /usr/bin/ssh
cp /usr/local/openssh9p8/bin/ssh-keygen /usr/bin/ssh-keygen
cp -p contrib/redhat/sshd.init /etc/init.d/sshd
chmod +x /etc/init.d/sshd
vim /etc/ssh/sshd_config
PermitRootLogin yes
# 允许root用户通过SSH登录到系统
PubkeyAuthentication yes
# 启用公钥身份验证
PasswordAuthentication yes
# 启用密码身份验证
/usr/local/openssh9p8/sbin/sshd -t -f /etc/ssh/sshd_config
systemctl enable sshd
systemctl restart sshd.service
openssh升级-适合redhat8.5和kylin v10
最新推荐文章于 2024-08-12 11:56:10 发布