publickey,gssapi-with-mic,Unspecified GSS failure

简介:         最近的MHA配置时碰到了Permission denied (publickey,gssapi-with-mic,password)这个错误提示,同时在使用ssh -v时,出现了Unspecified GSS failure错误。

        最近的MHA配置时碰到了Permission denied (publickey,gssapi-with-mic,password)这个错误提示,同时在使用ssh -v时,出现了Unspecified GSS failure错误。这个主要是使用了GSSAPI 的认证功能导致的。客官,如果你碰到了在使用scp很慢的情况下,也是这个原因。不妨继续往下看。

 

1、故障现象
# masterha_check_ssh --conf=/etc/app1.cnf
Wed Apr  8 14:33:26 2015 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.
           ...............
Permission denied (publickey,gssapi-with-mic,password).
Wed Apr  8 14:33:26 2015 - [error][/usr/lib/perl5/site_perl/5.8.8/MHA/SSHCheck.pm, ln86] SSH connection from
   root@vdbsrv1(192.168.1.6:22) to root@vdbsrv2(192.168.1.7:22) failed!

### ssh到另一主机时,花费20s左右
# time ssh 192.168.1.7 date
Wed Apr 15 21:33:53 CST 2015

real   0m20.245s
user   0m0.013s
sys 0m0.007s

### 使用-v参数ssh连接
# ssh -v 192.168.1.7
OpenSSH_4.3p2, OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to 192.168.1.7 [192.168.1.7] port 22.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: identity file /root/.ssh/identity type -1
debug1: identity file /root/.ssh/id_rsa type 1
debug1: identity file /root/.ssh/id_dsa type -1
debug1: loaded 3 keys
debug1: Remote protocol version 2.0, remote software version OpenSSH_4.3
debug1: match: OpenSSH_4.3 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_4.3
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host '192.168.1.7' is known and matches the RSA host key.
debug1: Found key in /root/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-with-mic,password
debug1: Next authentication method: gssapi-with-mic
debug1: Unspecified GSS failure.  Minor code may provide more information
No credentials cache found

debug1: Unspecified GSS failure.  Minor code may provide more information
No credentials cache found

debug1: Unspecified GSS failure.  Minor code may provide more information
No credentials cache found

debug1: Next authentication method: publickey
debug1: Trying private key: /root/.ssh/identity
debug1: Offering public key: /root/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 277
debug1: read PEM private key done: type RSA
debug1: Authentication succeeded (publickey).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
Last login: Wed Apr 15 16:56:12 2015 from 192.168.1.124

 

2、故障解决
###查看目标端的GSSAPI options
[root@vdbsrv2 ~]# grep GSSAPI /etc/ssh/sshd_config
# GSSAPI options
#GSSAPIAuthentication no
GSSAPIAuthentication yes      ###此时为开启GSSAPI认证
#GSSAPICleanupCredentials yes
GSSAPICleanupCredentials yes

### Author : Leshami
### Blog   :
http://blog.csdn.net/leshami

[root@vdbsrv2 ~]# cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bk
[root@vdbsrv2 ~]# vi /etc/ssh/sshd_config           ###关闭该认证方式
[root@vdbsrv2 ~]# grep GSSAPI /etc/ssh/sshd_config  ###查看关闭后的结果
# GSSAPI options
GSSAPIAuthentication no
#GSSAPIAuthentication yes
#GSSAPICleanupCredentials yes
GSSAPICleanupCredentials yes

###重启sshd服务
[root@vdbsrv2 ~]# service sshd restart
Stopping sshd: [  OK  ]
Starting sshd: [  OK  ]

###再次测试,仅仅0.191s,ssh -v时也无异常报错
[root@vdbsrv1 ~]# time ssh 192.168.1.7 date
Wed Apr 15 21:48:10 CST 2015

real   0m0.191s
user   0m0.014s
sys 0m0.003s


ssh连接过慢的另外一种情形(补充@20160629):

基于sshd_config修改以下配置项,

UseDNS=no


UseDNS  Specifies whether sshd(8) should look up the remote host name and check that the resolved host name for the remote IP
             address maps back to the very same IP address.  The default is “yes”.

该选项指定当客户端试图登录OpenSSH服务器时,服务器是否需要根据客户端的IP地址进行DNS PTR反向查询,查询出客户端的host name,然后根据查询出的客户端host name进行NS 正向A记录查询,验证与其原始IP地址是否一致,这是防止客户端欺骗的一种手段。如果该值为Yes,则修改服务器端hosts文件,添加对应记录也可以达到加快的目的。

目录
相关文章
|
9天前
|
算法 JavaScript
Error: error:0308010C:digital envelope routines::unsupported
# 报错 (node:16863) [DEP_WEBPACK_CONFIGURATION_OPTIMIZATION_NO_EMIT_ON_ERRORS] DeprecationWarning: optimization.noEmitOnErrors is deprecated in favor of optimization.emitOnErrors (Use `node --trace-deprecation ...` to show where the warning was created) (node:16863) [DEP_WEBPACK_COMPILATION_OPTIMIZE_C
|
26天前
|
Unix 网络安全 数据安全/隐私保护
putty Faual Error:No supported authentication methods available (server sent: publickey)
putty Faual Error:No supported authentication methods available (server sent: publickey)
39 0
|
4天前
|
安全 网络安全
Peer's certificate issuer has been marked as not trusted by the user. 是什么原因导致的
"Peer's certificate issuer has been marked as not trusted by the user" 是一个SSL/TLS错误消息,通常出现在与安全连接的服务器进行握手时。这个错误消息表示用户将证书颁发机构(Certificate Authority,CA)标记为不受信任。 这种情况可能有以下几个原因: 1. 证书过期:证书有一个有效期限,如果证书已经过期,浏览器会将其标记为不受信任。 2. 证书颁发机构不受信任:浏览器内置了一些受信任的证书颁发机构列表,如果服务器使用的证书颁发机构不在该列表中,浏览器会将其标记为不受信任。 3. 自签名证书:如
|
1月前
|
NoSQL Redis 数据库
解决noauth authentication required异常
解决noauth authentication required异常
解决noauth authentication required异常
|
2月前
【Error】fatal: unable to access ‘https://github.com/PanJiaChen/vue-element-admin/‘: OpenSSL SSL_read:
【Error】fatal: unable to access ‘https://github.com/PanJiaChen/vue-element-admin/‘: OpenSSL SSL_read:
|
3月前
|
开发工具 数据安全/隐私保护 git
Authentication failed for 错误
Authentication failed for 错误
|
5月前
|
存储 小程序 API
报错-小程序:errMsg: “getUserProfile:fail privacy permission is not authorized“
报错-小程序:errMsg: “getUserProfile:fail privacy permission is not authorized“
168 0
|
7月前
|
分布式计算 Hadoop Linux
Centos7配置Hadoop出现Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password)的解决
Centos7配置Hadoop出现Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password)的解决
246 0
|
网络安全 数据安全/隐私保护
阿里云Permission denied (publickey,gssapi-keyex,gssapi-with-mic)
阿里云Permission denied (publickey,gssapi-keyex,gssapi-with-mic)
198 0
|
算法 网络安全 开发工具
Permission denied (publickey,gssapi-with-mic). fatal: Could not read from remote repository.
Permission denied (publickey,gssapi-with-mic). fatal: Could not read from remote repository.