服务器A通过ssh -v root@ip地址B 时,提示以下报错,
排查情形有1:服务器B能够正常ssh到服务器A;2:hosts.allow已配置也重启过sshd,但没有效果;3:检查sshd_config配置已无问题,4:服务器Aping或telnet服务器B都正常,请求各路大神赐教,拜谢。OpenSSH_7.9p1, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to ip地址B [ip地址B] port 22.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: identity file /root/.ssh/identity type -1
debug1: identity file /root/.ssh/identity-cert type -1
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: Remote protocol version 2.0, remote software version OpenSSH_7.9
debug1: match: OpenSSH_7.9 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.9
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-sha1 none
debug1: kex: client->server aes128-ctr hmac-sha1 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<2048<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 'ip地址B' is known and matches the RSA host key.
debug1: Found key in /root/.ssh/known_hosts:42
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,password
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
Connection closed by ip地址B

解决方案 »

  1.   

    服务器B上的日志messages输出内容有一个报错是:
    Aug 20 12:00:18 TS-NW-S07 smbd[2855]: [2019/08/20 12:00:18.199143,  0] printing/print_cups.c:528(cups_async_callback)
    Aug 20 12:00:18 TS-NW-S07 smbd[2855]:   failed to retrieve printer list: NT_STATUS_UNSUCCESSFUL
    Aug 20 12:13:18 TS-NW-S07 smbd[88015]: [2019/08/20 12:13:18.885695,  0] printing/print_cups.c:151(cups_connect)
    Aug 20 12:13:18 TS-NW-S07 smbd[88015]:   Unable to connect to CUPS server localhost:631 - Connection refusedsmb.conf配置如下,是跟这个有关系
    load printers = yes
            cups options = raw;       printcap name = /etc/printcap
            #obtain list of printers automatically on SystemV
    ;       printcap name = lpstat
    ;       printing = cups
      

  2.   


    应该不是,你看看secure日志
      

  3.   

    secure日志里并没有关于服务器A的日志信息,不过有其他服务器地址的日志信息如下:Aug 20 12:47:27 TS-NW-S07 sshd[90020]: pam_unix(sshd:account): password for user weblogic will expire in 14 days
    Aug 20 12:47:27 TS-NW-S07 sshd[90020]: Accepted password for weblogic from 服务器C port 52738 ssh2
    Aug 20 12:47:27 TS-NW-S07 sshd[90020]: pam_unix(sshd:session): session opened for user weblogic by (uid=0)
    Aug 20 12:47:37 TS-NW-S07 su: pam_unix(su-l:session): session opened for user root by weblogic(uid=502)
      

  4.   

    看你上面的日志,好像是使用密钥登录时,被拒绝了。应该secure会有日志。
    你看下B的/root/.ssh/authorized_keys里面有没有A的记录,有的话  可以考虑删掉,然后重新传一次公钥;或者使用密码登录
      

  5.   

    B这个应该没有禁用密码的,跟服务器A同一网段的其他服务器是能够正常ssh到B的;authorized_keys文件删除重建互信过也不行,另外我是把ssh命令执行与查看secure日志同步进行的,B上的确是没有日志进来,很奇怪