本文主要是介绍如何启用SSHD的调试模式进行调试,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
如何启用SSHD的调试模式进行调试
- 1. 服务器启动调试模式
- 2. 客户端启动调试模式
- 3. 错误日志
1. 服务器启动调试模式
h-4.2# /usr/sbin/sshd -f /export/Data/cfs/config/sftp/sshd_config -d -p 1234
debug1: sshd version OpenSSH_6.6.1, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: key_parse_private2: missing begin marker
debug1: read PEM private key done: type RSA
debug1: private host key: #0 type 1 RSA
debug1: key_parse_private2: missing begin marker
debug1: read PEM private key done: type DSA
debug1: private host key: #1 type 2 DSA
debug1: key_parse_private2: missing begin marker
debug1: read PEM private key done: type ECDSA
debug1: private host key: #2 type 3 ECDSA
debug1: key_parse_private2: missing begin marker
debug1: read PEM private key done: type DSA
debug1: private host key: #3 type 2 DSA
debug1: rexec_argv[0]='/usr/sbin/sshd'
debug1: rexec_argv[1]='-f'
debug1: rexec_argv[2]='/export/Data/cfs/config/sftp/sshd_config'
debug1: rexec_argv[3]='-d'
debug1: rexec_argv[4]='-p'
debug1: rexec_argv[5]='1234'
Set /proc/self/oom_score_adj from 993 to -1000
debug1: Bind to port 1234 on 0.0.0.0.
Server listening on 0.0.0.0 port 1234.
debug1: Bind to port 1234 on ::.
Server listening on :: port 1234.
2. 客户端启动调试模式
(base)ZBMAC-9b3ab3c69:~ atang$ ssh -vp 1234 admin@sftp.atang.com
OpenSSH_7.8p1, LibreSSL 2.6.2
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 48: Applying options for *
debug1: Connecting to sftp.atang.com port 1234.
debug1: Connection established.
debug1: identity file /Users/atang/.ssh/id_rsa type 0
debug1: identity file /Users/atang/.ssh/id_rsa-cert type -1
debug1: identity file /Users/atang/.ssh/id_dsa type -1
debug1: identity file /Users/atang/.ssh/id_dsa-cert type -1
debug1: identity file /Users/atang/.ssh/id_ecdsa type -1
debug1: identity file /Users/atang/.ssh/id_ecdsa-cert type -1
debug1: identity file /Users/atang/.ssh/id_ed25519 type -1
debug1: identity file /Users/atang/.ssh/id_ed25519-cert type -1
debug1: identity file /Users/atang/.ssh/id_xmss type -1
debug1: identity file /Users/atang/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.8
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 0x04000002
debug1: Authenticating to sftp.atang.com:1234 as 'admin'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256@libssh.org
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:7bCNuDdmBkwku+6OpEI8iP6pOXJnbycC6Ph/ECF7Qmw
debug1: checking without port identifier
debug1: Host 'sftp.atang.com' is known and matches the ECDSA host key.
debug1: Found key in /Users/atang/.ssh/known_hosts:18
debug1: found matching key w/out port
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic
debug1: Next authentication method: publickey
debug1: Offering public key: RSA SHA256:id6ElUY61qnp8efjKl5ifvYebqLbi8bASv8z88UQEIk /Users/atang/.ssh/id_rsa
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic
debug1: Trying private key: /Users/atang/.ssh/id_dsa
debug1: Trying private key: /Users/atang/.ssh/id_ecdsa
debug1: Trying private key: /Users/atang/.ssh/id_ed25519
debug1: Trying private key: /Users/atang/.ssh/id_xmss
debug1: No more authentication methods to try.
admin@sftp.atang.com: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
3. 错误日志
启动后server端日志信息
debug1: Server will not fork when running in debugging mode.
debug1: rexec start in 5 out 5 newsock 5 pipe -1 sock 8
debug1: inetd sockets after dupping: 3, 3
Connection from 172.22.141.3 port 2051 on 11.80.25.166 port 1234
debug1: Client protocol version 2.0; client software version OpenSSH_7.8
debug1: match: OpenSSH_7.8 pat OpenSSH* compat 0x04000000
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1
debug1: SELinux support disabled [preauth]
debug1: permanently_set_uid: 74/74 [preauth]
debug1: list_hostkey_types: ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ssh-dss [preauth]
debug1: SSH2_MSG_KEXINIT sent [preauth]
debug1: SSH2_MSG_KEXINIT received [preauth]
debug1: kex: client->server chacha20-poly1305@openssh.com <implicit> none [preauth]
debug1: kex: server->client chacha20-poly1305@openssh.com <implicit> none [preauth]
debug1: kex: curve25519-sha256@libssh.org need=64 dh_need=64 [preauth]
debug1: kex: curve25519-sha256@libssh.org need=64 dh_need=64 [preauth]
debug1: expecting SSH2_MSG_KEX_ECDH_INIT [preauth]
debug1: SSH2_MSG_NEWKEYS sent [preauth]
debug1: expecting SSH2_MSG_NEWKEYS [preauth]
debug1: SSH2_MSG_NEWKEYS received [preauth]
debug1: KEX done [preauth]
debug1: userauth-request for user admin service ssh-connection method none [preauth]
debug1: attempt 0 failures 0 [preauth]
debug1: PAM: initializing for "admin"
debug1: PAM: setting PAM_RHOST to "172.22.141.3"
debug1: PAM: setting PAM_TTY to "ssh"
debug1: userauth-request for user admin service ssh-connection method publickey [preauth]
debug1: attempt 1 failures 0 [preauth]
debug1: test whether pkalg/pkblob are acceptable [preauth]
debug1: temporarily_use_uid: 600/600 (e=0/0)
debug1: trying public key file /home/admin/.ssh/authorized_keys
debug1: Could not open authorized keys '/home/admin/.ssh/authorized_keys': No such file or directory
debug1: restore_uid: 0/0
debug1: temporarily_use_uid: 600/600 (e=0/0)
debug1: trying public key file /home/admin/.ssh/authorized_keys2
debug1: Could not open authorized keys '/home/admin/.ssh/authorized_keys2': No such file or directory
debug1: restore_uid: 0/0
Failed publickey for admin from 172.22.141.3 port 2051 ssh2: RSA 83:ae:3a:71:c5:1e:02:92:10:a2:ac:9f:d8:3d:20:87
Connection closed by 172.22.141.3 [preauth]
debug1: do_cleanup [preauth]
debug1: monitor_read_log: child log fd closed
debug1: do_cleanup
debug1: PAM: cleanup
debug1: Killing privsep child 117295
这篇关于如何启用SSHD的调试模式进行调试的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!