openssh升级sftp_升级openssh7.9

这篇博客介绍了如何手动升级OpenSSH到7.9p1版本,包括编译安装步骤和解决升级后的权限问题。在升级过程中,涉及到了openssl的安装、配置选项设置以及文件权限的调整。升级完成后,由于SELinux的限制,sshd服务可能无法自动启动,通过修改SELINUX配置为disabled解决了这一问题。
摘要由CSDN通过智能技术生成

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服务可以自动启动了

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值