linux升级openssh版本,升级到8.6p1
小白教程,一看就会,一做就成。
1.下载rpm包
2.编写一键安装脚本(然后执行)
#把所有的rpm包,我都放到了/ydy目录,下面安装时,也指定了这个目录
#编辑安装脚本
vim sshssl-centos7.sh
#内容如下#/bin/bash
#安装telnet,防止22不能连接,可以用telnet ip 连接
yum -y install telnet-server* xinetd wget*
systemctl start telnet.socket
systemctl restart xinetd.service
echo "pts/0" >> /etc/securetty
echo "pts/1" >> /etc/securetty
echo "pts/2" >> /etc/securetty
echo "pts/3" >> /etc/securetty
echo "pts/4" >> /etc/securetty#安装openssl(可以与老版本共存)
rpm -ivh --nodeps --force /ydy/openssl-*#安装openssh(安装后最好卸载老版本)这里升级安装就不用卸载了,用Uvh
rpm -Uvh --nodeps --force /ydy/openssh-*#向sshd配置文件写入配置
echo "Port 22" >> /etc/ssh/sshd_config
echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
echo "UseDNS no" >> /etc/ssh/sshd_config
echo "UsePAM yes" >> /etc/ssh/sshd_config
#给ssh_host_ed25519_key变更成400权限(ssh_host_ed25519_key是必须要变更的,另外两个没变更也能启动sshd,也加上吧)
chmod 400 /etc/ssh/ssh_host_ed25519_key
chmod 400 /etc/ssh/ssh_host_ecdsa_key
chmod 400 /etc/ssh/ssh_host_rsa_key
#重启sshd
systemctl restart sshd
3.查看版本
ssh -V
4.卸载telnet(这里也是写的脚本,也是执行就可以)
#编辑脚本
vim telnet7-stop.sh
#内容如下#!/bin/bash
#关闭telnet的23端口
systemctl stop telnet.socket
systemctl stop xinetd.service#卸载telnet
yum -y remove telnet-server* xinetd
5.完成