升级openssh7.9

umask 022
yum install -y pam-devel libselinux-devel krb5-devel zlib-devel gcc make
LANG=C
cd /root
tar xf openssl-1.0.2r.tar.gz
tar xf openssh-7.9p1.tar.gz
cd /root/openssl-1.0.2r
./config --prefix=/usr/local/openssl-1.0.2r --openssldir=/usr/local/openssl-1.0.2r zlib shared && make -j 4 && make install

echo '/usr/local/openssl-1.0.2r/lib' > /etc/ld.so.conf.d/openssl.conf
ldconfig
chmod 600 /etc/ssh/ssh_host_*

cd /root/openssh-7.9p1
./configure --prefix=/usr/local/openssh7.9p1 --sysconfdir=/etc/ssh --with-selinux --with-pam\
 --with-ssl-dir=/usr/local/openssl-1.0.2r\
 --with-md5-passwords --with-zlib --mandir=/usr/share/man\
 --with-kerberos5 --with-xauth --with-sandbox\
 && make -j 4 && make install 

alias cp='cp'

cp /root/openssh-7.9p1/contrib/redhat/sshd.init /etc/init.d/sshd

chmod +x /etc/init.d/sshd

cp -f /usr/local/openssh7.9p1/bin/* /usr/bin/
cp -f /usr/local/openssh7.9p1/sbin/* /usr/sbin/
cp -f /usr/local/openssh7.9p1/libexec/* /usr/libexec/openssh/


restorecon /usr/bin/{scp,sftp,ssh,ssh-add,ssh-agent,ssh-keygen,ssh-keyscan}
restorecon /usr/sbin/sshd
restorecon /usr/libexec/openssh/{sftp-server,ssh-keysign,ssh-pkcs11-helper}

以上代码可以放在一个文件中自动执行升级


升级完成后要执行,让root可以登录

echo "PermitRootLogin yes" >> /etc/ssh/sshd_config


如果已经设置了

chkconfig sshd on

但不能在重启后自动启动sshd服务,但可以手动开启服务成功,并有可能报错如下

[root@rhel6 init.d]# service sshd start
Starting sshd:/usr/sbin/sshd: error while loading shared libraries: libcrypto.so.1.0.0: failed to map segment from shared object: Permission denied
[FAILED]

需要检查

getenforce是否是Enforcing,打开/etc/selinux的配置文件config,将SELINUX改为disabled。启动服务不再报错,重启系统

sshd服务可以自动启动了


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26870952/viewspace-2651674/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/26870952/viewspace-2651674/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
升级 RHEL 7 上的 OpenSSH 时,需要遵循以下步骤: 1.检查系统版本信息 在终端中输入以下命令来确认当前版本信息: ```shell cat /etc/redhat-release ``` 2.下载 OpenSSH 7.9 从官方网站或镜像站点下载 OpenSSH 7.9 的源文件。这些文件通常是一个 tar 包,包含配置文件、源代码和文档。 3.备份配置文件 在升级之前,需要备份配置文件,以确保在升级过程中不会丢失任何数据。在终端中输入以下命令备份配置文件: ```shell mv /etc/ssh/sshd_config /etc/ssh/sshd_config.bak ``` 4.解压 OpenSSH 源文件 在终端中输入以下命令,解压 OpenSSH 源文件: ```shell tar -zxvf openssh-7.9.tar.gz ``` 5.编译和安装 OpenSSH 7.9 在终端中输入以下命令以编译和安装 OpenSSH 7.9: ```shell cd openssh-7.9 ./configure && make && make install ``` 6.恢复备份的配置文件 在终端中输入以下命令恢复备份的配置文件: ```shell mv /etc/ssh/sshd_config.bak /etc/ssh/sshd_config ``` 7.重新启动 SSH 服务 在终端中输入以下命令重启 SSH 服务: ```shell systemctl restart sshd ``` 8.检查 SSH 版本信息 在终端中输入以下命令检查 SSH 版本信息: ```shell ssh -V ``` 以上是升级 RHEL 7 上的 OpenSSH 7.9 的步骤,需要做好备份和恢复工作,确保升级过程中不会丢失任何数据和配置文件。同时,也需要注意升级后是否引入了新的安全漏洞,在升级后应该及时进行安全检查和修复。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值