centos7升级openssh9.3p1
  zVWoiYoNQqhO 2023年11月02日 48 0

首先查看当前版本 centos7 默认使用ssh

ssh -V 
OpenSSH_7.4p1, OpenSSL 1.0.2k-fips  26 Jan 2017

安装依赖包

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

下载SSH9.3源码包

官网下载  https://www.openssh.com

离线下载对应版本     openssh-9.3p1.tar.gz 

centos7升级openssh9.3p1_linux

在线下载对应版本 推荐

wget -c https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-9.3p1.tar.gz 
mv openssh-9.3p1.tar.gz /opt && cd /opt

解压安装

tar -zxvf openssh-9.3p1.tar.gz  #解压
cd openssh-9.3p1 
#执行安装
./configure --with-md5-passwords --with-pam --with-selinux --with-privsep-path=/sshd --sysconfdir=/etc/ssh
#由于启用了PAM则需要安装一个配置文件,该文件在contrib目录下
cp -a contrib/redhat/sshd.pam /etc/pam.d/sshd.pam
#拷贝开机启动脚本
cp -a contrib/redhat/sshd.init /etc/init.d/sshd
make && make install   #编译成可执行文件
#修改文件权限
chmod 600 /etc/ssh/ssh_host_rsa_key
chmod 600 /etc/ssh/ssh_host_ecdsa_key
chmod 600 /etc/ssh/ssh_host_ed25519_key

如果编译完成不授权文件权限则会报如下错误,需提升对应文件夹权限

centos7升级openssh9.3p1_远程登录_02





修改配置文件  允许root远程登录

将PermitRootLogin prohibit-password 修改为 PermitRootLogin yes 

vim /etc/ssh/sshd_config
PermitRootLogin yes

关闭DNS选项加快访问

PubkeyAuthentication yes

注释下面2个配置

#GSSAPIAuthentication yes
#GSSAPICleanupCredentials no

检查ssh配置 无报错即为正常

#检查是否有配置错误
sshd -t

启动服务

systemctl restart sshd
systemctl enable sshd
systemctl status sshd

查看openssh版本

ssh -V

最后自行远程登录验证 


【版权声明】本文内容来自摩杜云社区用户原创、第三方投稿、转载,内容版权归原作者所有。本网站的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@moduyun.com

  1. 分享:
最后一次编辑于 2023年11月08日 0

暂无评论

推荐阅读
  6YY0QMPUXEwu   2023年12月10日   29   0   0 linux网卡
  Ex81gqy3LOX7   2023年12月07日   19   0   0 linux
  nIt0XG0acU8j   2023年12月11日   29   0   0 linuxhtop
  nIt0XG0acU8j   2023年12月09日   33   0   0 linuxsort
  9JCEeX0Eg8g4   2023年12月11日   23   0   0 mysql配置文件