|  | 
 
| 前言 CentOS 6.x 和 7.x 的断裂带来很多麻烦,习惯SysV下面的init.d脚本后,转systemd很不适应,之前还花了点时间学systemd,但是可能是年龄大了,老是记不住命令,以后还是转回ubuntu去吧。
 
 一,安装telnet
 升级个ssh,为什么要装telnet?因为很多人在管理服务器的时候,用的就是ssh远程连接,升级ssh失败的话连接会断开,所以必须先装个telnet,用telnet登录上去操作。
 
 
 复制代码yum -y install telnet-server.x86_64
 各自系统版本不一样可能telnet server叫不同名字,安装前用 yum search 搜一下就知道了。
 装好后,更改配置文件,允许telnet远程连接:
 
 
 如果这里不支持nano,就用vi吧,需要一些vi知识,本论坛搜索vi有教程复制代码nano /etc/xinetd.d/telnet
 将disable = yes改为 disable = no,退出保存。
 然后启动telnet服务:
 
 
 或者:
 
 
 如果有开防火墙,最好先把防火墙关掉:
 
 
 复制代码service iptables stop
chkconfig iptables off
 或者:
 
 
 复制代码systemctl stop firewalld
systemctl disable firewalld
PS:如果windows上登录,需要在控制面吧,添加删除功能里增加telnet客户端,然后cmd进dos里telnet ip地址 即可登录
 在客户端登录一下试试,这里注意一点,如果想用root用户登录,还要再改一点配置:
 
 
 
 在末尾添加几行(测试阿里云加到4就行,腾讯云要到6):
 
 
 复制代码pts/0
pts/1
pts/2
pts/3
pts/4
pts/5
pts/6
 最好多加几个,因为你也不知道你的telnet连接对应的是几号。
 添加好之后重启xinetd服务,就可以用root登录了。登录不了,就去服务器开启23端口。
 如果root权限也改不了 看看安全狗、云锁之类的软件有没开启防篡改之类的 暂时关闭下。
 如果还是无法登录就查登录日志
 
 然后再想办法解决问题
 
 二,升级ssh
 注意,从这里开始,就要用刚刚装好的telnet登录来操作了。
 先关闭ssh
 
 
 
 或者:
 
 
 
 然后安装openssl的开发版,编译openssh时需要它:
 
 
 复制代码yum install -y openssl openssl-devel 
 安装好之后,去https://www.openssh.com/portable.html下载openssh安装包,这里要注意,openssh本来是给FreeBSD开发的,所以这里要下载的是它的Portable版本,这个版本才能在linux下安装,这个版本名字里面都带p1。
 我们下载openssh-7.9p1.tar.gz,然后运行
 
 复制代码tar zxvf openssh-7.9p1.tar.gz
cd openssh-7.9p1
 接下来,可以参考官方的安装文档:
 
 
 2. Building / Installation
 --------------------------
 
 To install OpenSSH with default options:
 
 
 复制代码./configure
make
make install
 下边说明可以不看啦
 
 This will install the OpenSSH binaries in /usr/local/bin, configuration files
 in /usr/local/etc, the server in /usr/local/sbin, etc. To specify a different
 installation prefix, use the --prefix option to configure:
 
 ./configure --prefix=/opt
 make
 make install
 
 Will install OpenSSH in /opt/{bin,etc,lib,sbin}. You can also override
 specific paths, for example:
 
 ./configure --prefix=/opt --sysconfdir=/etc/ssh
 make
 make install
 
 This will install the binaries in /opt/{bin,lib,sbin}, but will place the
 configuration files in /etc/ssh.
 
 If you are using Privilege Separation (which is enabled by default)
 then you will also need to create the user, group and directory used by
 sshd for privilege separation.  See README.privsep for details.
 
 完整版安装指南:http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/INSTALL
 
 
 ---------------------
 原作者:愚蠢的小根儿,邱嵩松(收录时有细化说明)
 
 
 
 | 
 |