首页 > 系统相关 > centos-7连接ssh慢

centos-7连接ssh慢

时间:2023-02-24 14:56:06浏览次数:43  
标签:debug1 centos type SSH2 ssh MSG root 连接

centos-7连接ssh慢

1. centos-7连接ssh慢

这段时间使用虚拟机装载了CentOS 7.9版本的Linux操作系统,配置好相关信息参数后,发现使用SSH命令远程连接访问服务器时,总是需要等待几十秒,不能直接按完回车后,立即跳出输入登录密码的命令提示符。所以上网搜索了一下问题。知道了问题所在。主要是由两个原因造成了。

  • DNS反向解析的问题
  • Gssap认证问题

2 . 使用ssh连接打出debug查看

[root@appnode2 ~]# ssh -p22 [email protected] -v
OpenSSH_6.6.1, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 56: Applying options for *
debug1: Connecting to 172.16.128.25 [172.16.128.25] port 22.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: identity file /root/.ssh/id_rsa type 1
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: identity file /root/.ssh/id_dsa type -1
debug1: identity file /root/.ssh/id_dsa-cert type -1
debug1: identity file /root/.ssh/id_ecdsa type -1
debug1: identity file /root/.ssh/id_ecdsa-cert type -1
debug1: identity file /root/.ssh/id_ed25519 type -1
debug1: identity file /root/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1
debug1: match: OpenSSH_6.6.1 pat OpenSSH_6.6.1* compat 0x04000000
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr [email protected] none
debug1: kex: client->server aes128-ctr [email protected] none
debug1: kex: [email protected] need=16 dh_need=16
debug1: kex: [email protected] need=16 dh_need=16
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA 46:f7:fe:0b:07:80:2d:eb:b5:2f:0e:33:fa:cb:cf:fb
debug1: Host '172.16.128.25' is known and matches the ECDSA host key.
debug1: Found key in /root/.ssh/known_hosts:22
debug1: ssh_ecdsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Next authentication method: gssapi-keyex
debug1: No valid Key exchange context
debug1: Next authentication method: gssapi-with-mic
debug1: Unspecified GSS failure.  Minor code may provide more information
No Kerberos credentials available (default cache: KEYRING:persistent:0)

debug1: Unspecified GSS failure.  Minor code may provide more information
No Kerberos credentials available (default cache: KEYRING:persistent:0)

debug1: Next authentication method: publickey
debug1: Offering RSA public key: /root/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: key_parse_private2: missing begin marker
debug1: read PEM private key done: type RSA
debug1: Authentication succeeded (publickey).
Authenticated to 172.16.128.25 ([172.16.128.25]:22).
debug1: channel 0: new [client-session]
debug1: Requesting [email protected]
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
Last login: Fri May 27 09:55:28 2022 from appnode2

可以看到报错误信息 "Unspecified GSS failure. Minor code may provide more information"

3. 配置修改连接服务端配置

[root@test ~]# vim /etc/ssh/sshd_config

# 修改如下内容
GSSAPIAuthentication no      # 关闭gss认证接口
UseDNS no            # 关闭DNS解析功能


按:wq保存退出

GSSAPI ( Generic Security Services Application Programming Interface) 是一套类似Kerberos 5 的通用网络安全系统接口。该接口是对各种不同的客户端服务器安全机制的封装,以消除安全接口的不同,降低编程难度。但该接口在目标机器无域名解析时会有问题。系统是默认开启的,需要手动关闭即可。

4. 重启sshd服务

[root@test ~]# /bin/systemctl restart sshd

5. 检查sshd服务状态

[root@test ~]# /bin/systemctl status sshd

6. 尝试连接

[root@jenkins ~]# ssh [email protected]
Last login: Fri May 27 11:13:53 2022 from 172.19.4.66

配置没有问题,可以快速连接了

标签:debug1,centos,type,SSH2,ssh,MSG,root,连接
From: https://www.cnblogs.com/scajy/p/17151456.html

相关文章

  • centos7-分区2T以上大硬盘
    centos7-分区2T以上大硬盘1.centos7-分区2T以上大硬盘由于使用fdisk进行分区默认在2T内,大于2T后fdisk就无法进行大硬盘进行分区,需要对大于2TB进行分区,使用parted进行......
  • 99语法:外连接查询
    ​  --innerjoin-on子句:显示的是所有匹配的信息select*fromempeinnerjoindeptdone.deptno=d.deptno;select*fromemp;select*fromdept;--......
  • 99语法:外连接查询
    ​  --innerjoin-on子句:显示的是所有匹配的信息select*fromempeinnerjoindeptdone.deptno=d.deptno;select*fromemp;select*fromdept;--......
  • Xshell与Xfpt连接服务器(windows server)
    在服务器中下载OpenSSH下载地址:https://github.com/PowerShell/Win32-OpenSSH/releases下载后解压: 在解压后的文件夹内打开cmd 在其中输入命令,安装SSHpowersh......
  • 99语法:交叉连接,自然连接,内连接查询
    ​ 【1】多表查询引入:实际开发中往往需要针对两张甚至更多张数据表进行操作,而这多张表之间需要使用主键和外键关联在一起,然后使用连接查询来查询多张表中满足要求的数据......
  • 99语法:交叉连接,自然连接,内连接查询
    ​ 【1】多表查询引入:实际开发中往往需要针对两张甚至更多张数据表进行操作,而这多张表之间需要使用主键和外键关联在一起,然后使用连接查询来查询多张表中满足要求的数据......
  • JDBC——连接SQL Server环境配置
    JDBC:使用JAVA语言操作关系型数据库的API。是一套标准的接口。步骤1.创建工程,导入驱动jar包2.注册驱动:Class.forName("com.mysql.jdbc.Driver");3.获取连接:Connectionc......
  • Linux CentOS 7 磁盘扩容(原有磁盘扩容,非新增磁盘)
    背景:接上篇  https://www.cnblogs.com/si-yuan/p/17148835.html,只是展示出了磁盘大小,还需进行如下操作,去完成原有磁盘的扩容。--------------------------------------......
  • centos8 安装mysql8.0.11—shell自动化脚本
    需求说明自动化安装mysql8.0.11并修改密码为指定字符并根据提供的sql文件创建以文件名为名称的数据库并执行sql文件下载压缩包下载地址流程总览:1.将压缩包上传到......
  • Centos7.4搭建FTP服务器
    【Centos7.4搭建FTP服务器】搭建环境:Centos7.4版本、生产服务器、计划默认端口5000、被动模式端口5001-5005 一、关闭防火墙1systemctlstatusfirewalld.service#......