1、升级openssl

yum install perl
wget https://goodrain-delivery.oss-cn-hangzhou.aliyuncs.com/fuzhoushuchan/openssl-1.1.1g.tar.gz && tar xvf openssl-1.1.1g.tar.gz && cd openssl-1.1.1g/
./config --prefix=/usr/local/ssl #如果此步骤报错,需要安装perl以及gcc包
make && make install
mv /usr/bin/openssl /usr/bin/openssl.bak
ln -sf /usr/local/ssl/bin/openssl /usr/bin/openssl
echo "/usr/local/ssl/lib" >> /etc/ld.so.conf
ldconfig -v
$ openssl version
OpenSSL 1.1.1g 21 Apr 2020

2、升级openssh

1)下载最新opnssh软件

项目地址:https://openbsd.hk/pub/OpenBSD/OpenSSH/portable/

wget https://goodrain-delivery.oss-cn-hangzhou.aliyuncs.com/fuzhoushuchan/openssh-8.8p1.tar.gz && tar xvf openssh-8.8p1.tar.gz && cd openssh-8.8p1/

2)安装依赖包

yum install zlib-devel openssl-devel pam-devel libss -y

3)备份

mkdir /etc/ssh_bak
mv /etc/ssh/* /etc/ssh_bak

3)解压、编译、安装

./configure --prefix=/usr/ --sysconfdir=/etc/ssh --with-ssl-dir=/usr/local/ssl --with-zlib --with-pam --with-md5-password --with-ssl-engine --with-selinux  --host x86_64
make && make install 8.6:
./configure --prefix=/usr/ --sysconfdir=/etc/ssh --with-openssl-includes=/usr/local/ssl/include --with-ssl-dir=/usr/local/ssl --with-zlib --with-md5-passwords --with-pam && make && make install

4)修改配置文件(按照实际情况配置,见文末)

vi /etc/ssh/sshd_config
# 这三行改为 yes
PermitRootLogin yes #这项一定要改成yes,否则登陆不进去
PubkeyAuthentication yes
PasswordAuthentication yes

5)移走以前的ssh服务, 防止与新的冲突

mv /usr/lib/systemd/system/sshd.service /etc/ssh_bak/sshd.service
mv /usr/lib/systemd/system/sshd.socket /etc/ssh_bak/sshd.socket

6)在解压包中拷贝一些文件

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

7)重新启动ssh

/etc/init.d/sshd restart
systemctl daemon-reload

8)添加自启动

chkconfig --add sshd
chkconfig sshd on

查看:

$ chkconfig --list sshd

Note: This output shows SysV services only and does not include native
systemd services. SysV configuration data might be overridden by native
systemd configuration. If you want to list systemd services use 'systemctl list-unit-files'.
To see services enabled on particular target use
'systemctl list-dependencies [target]'. sshd 0:off 1:off 2:on 3:on 4:on 5:on 6:off

1表示:单用户模式

2表示:无网络连接的多用户命令行模式

3表示:有网络连接的多用户命令行模式

4表示:不可用

5表示:带图形界面的多用户模式

6表示:重新启动

9)检测升级版本

$ ssh -V
OpenSSH_8.8p1, OpenSSL 1.1.1g 21 Apr 2020

sshd_config文件

# This is the sshd server system-wide configuration file.  See
# sshd_config(5) for more information. # This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin # The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented. Uncommented options override the
# default value. #Port 22
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress :: #HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_ecdsa_key
#HostKey /etc/ssh/ssh_host_ed25519_key
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key # Ciphers and keying
#RekeyLimit default none # Logging
#SyslogFacility AUTH
SyslogFacility AUTHPRIV
#LogLevel INFO # Authentication: #LoginGraceTime 2m
#PermitRootLogin prohibit-password
PermitRootLogin yes
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10 #PubkeyAuthentication yes # The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2
# but this is overridden so installations will only check .ssh/authorized_keys
AuthorizedKeysFile .ssh/authorized_keys #AuthorizedPrincipalsFile none #AuthorizedKeysCommand none
#AuthorizedKeysCommandUser nobody # For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes # To disable tunneled clear text passwords, change to no here!
PasswordAuthentication yes
#PermitEmptyPasswords no # Change to no to disable s/key passwords
ChallengeResponseAuthentication no # Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no # GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes # Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication. Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
UsePAM yes #AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
#PermitTTY yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS no
#PidFile /var/run/sshd.pid
#MaxStartups 10:30:100
#PermitTunnel no
#ChrootDirectory none
#VersionAddendum none # no default banner path
#Banner none # override default of no subsystems
Subsystem sftp /usr/libexec/sftp-server # Example of overriding settings on a per-user basis
#Match User anoncvs
# X11Forwarding no
# AllowTcpForwarding no
# PermitTTY no
# ForceCommand cvs server
AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE
AcceptEnv XMODIFIERS

CentOS ssh版本升级的更多相关文章

  1. centos ssh配置使用

    配置 数据阶梯 CentOS SSH配置 默认CentOS已经安装了OpenSSH,即使你是最小化安装也是如此.所以这里就不介绍OpenSSH的安装了. SSH配置: 1.修改vi /etc/ssh/ ...

  2. Putty CentOS SSH 总是自动断开连接

    /********************************************************************** * Putty CentOS SSH 总是自动断开连接 ...

  3. Window下使用Xshell连接VirtualBox中CentOS SSH最佳实践

    网上已经有非常多讲怎样连接VMware的文章.可是针对一些可能遇到的细节没有讲全. 这里会有一个非常 实际的样例,附带全部软件的链接,保证成功. 最佳实践什么的都是骗人的. 1.安装VirtualBo ...

  4. 诊断并解决CentOS SSH连接慢的方法

    诊断并解决CentOS SSH连接慢的方法: http://os.51cto.com/art/201507/484743.htm

  5. CentOS SSH安全和配置无密码登录

    CentOS ssh默认监听端口 22端口,允许root用户ssh登录.server投入生产后很有必要更改默认ssh监听端口和禁止root登录. 步骤1:确认安装有ssh包 [appuser@su17 ...

  6. centos ssh 无密码登录

    在linux系统中,ssh是远程登录的默认工具,因为该工具的协议使用了RSA/DSA的加密算法.该工具做linux系统的远程管理是非常安全的.telnet,因为其不安全性,在linux系统中被搁置使用 ...

  7. CentOS SSH配置

    默认CentOS已经安装了OpenSSH,即使你是最小化安装也是如此.所以这里就不介绍OpenSSH的安装了. SSH配置: 1.修改vi /etc/ssh/sshd_config,根据模板将要修改的 ...

  8. CentOS SSH安装与配置

    SSH 为 Secure Shell 的缩写,由 IETF 的网络工作小组(Network Working Group)所制定:SSH 为建立在应用层和传输层基础上的安全协议. 传 统的网络服务程序, ...

  9. CentOS SSH免密登陆

    #环境说明客户机:Mac OS X服务器:CentOS 6.5客户端:OpenSSH,OS X及大多数Linux都内置了OpenSSH.’ssh -v’命令可以查看版本. #大致流程1.在客户机创建一 ...

  10. centos python版本升级到3.x

    Linux(CentOS)下将Python的版本升级为3.6.2的方法 1.检查确认系统的相关信息 查看内核版本[root@zstest1 ~]# cat /etc/redhat-release Ce ...

随机推荐

  1. Java常用的十大开源工具类库总结

    以下是个人总结的Java常用的十大开源工具类库,根据具体需求和项目,可以选择合适的工具类库来提高开发效率.1. Apache Commons:Apache Commons是一个开源的工具类库,提供了大 ...

  2. 蚁群算法及 TSP 问题上的应用

    群智能(Swarm intelligence) 自然界动物群,称之为群. 群的特征: 相互作用的相邻个体的集合 个体的行为简单,既有竞争又有协作 智能化的集体行为(1+1>2): 个体间不仅能够 ...

  3. Kubernetes(七)数据存储

    数据存储 容器的生命周期可能很短,会被频繁地创建和销毁.容器在销毁时,保存在容器中的数据也会被清除.这种结果对用户来说,在某些情况下是不乐意看到的.为了持久化保存容器的数据,kubernetes引入了 ...

  4. Java常见问题-多线程

    现在有 T1.T2.T3 三个线程,你怎样保证 T2 在 T1 执行完后执行,T3 在 T2 执行完后执行? 这个多线程问题比较简单,可以用 join 方法实现. 在 Java 中 Lock 接口比 ...

  5. Curve 进入 CNCF Sandbox,完善统一云原生开源存储拼图

    2022 年 6 月 15 日,云原生计算基金会 (CNCF) 宣布,分布式存储系统 Curve 被正式接纳为 CNCF 沙箱(Sandbox)项目.Curve 由网易数帆开源,提供块存储和文件存储能 ...

  6. Swift开发基础01-语法

    Hello World print("Hello World") 不用编写main函数,Swift将全局范围内的首句可执行代码作为程序入口一句代码尾部可以省略分号(;),多句代码写 ...

  7. 当项目中使用到缓存,我们是选择 Redis 还是 Memcached ,为什么?

    举一些场景: 一.比如实现一个简单的日志收集功能或发送大量短信.邮件的功能,实现方式是先将数据收集到队列中,然后有一个定时任务去消耗队列,处理该做的事情. 直接使用 Redis 的 lpush,rpo ...

  8. [翻译]欢迎使用C#9.0

    本文由公众号[开发者精选资讯](微信号:yuantoutiao)翻译首发,转载请注明来源 C# 9.0 is taking shape, and I'd like to share our think ...

  9. [UE] 关于ue5中制作流日志记录

    UE5目前根据现有功能,配合Quixel Bridge可以做到地编和一些简单的动画,实现完整的游戏,但是目前随着版本的迭代,流程的定制需要更新 ControlRig方便在UE中做动画的,模拟动画等,U ...

  10. 【DataBase】MySQL 04 图形化用户界面管理工具

    参考至视频:P16 - P18 https://www.bilibili.com/video/BV1xW411u7ax?p=82 SQL图形化界面管理工具 - SQLyog 随便找的一个下载地址[安装 ...