一晚后无法使用 SSH

一晚后无法使用 SSH

我使用的是 CentOS 7 服务器。昨天晚上,我学习使用 SSH 和 SFTP。一切都好。我在 macOS 10.14.3 上通过 File Zilla 连接到 SFTP

SFTP:

sftp://103.48.194.xxx
user: root
password: ****
port: 22

但今天,我无法同时使用 SSH 和 SFTP。通过 macOS 终端进行 SSH,我发现我输入了正确的密码,但无法成功完成

的结果是ssh -v [email protected]

➜  ~ ssh -v [email protected]
OpenSSH_7.9p1, LibreSSL 2.7.3
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 48: Applying options for *
debug1: Connecting to 103.48.194.xx [103.48.194.xx] port 22.
debug1: Connection established.
debug1: identity file /Users/donhuvy/.ssh/id_rsa type 0
debug1: identity file /Users/donhuvy/.ssh/id_rsa-cert type -1
debug1: identity file /Users/donhuvy/.ssh/id_dsa type -1
debug1: identity file /Users/donhuvy/.ssh/id_dsa-cert type -1
debug1: identity file /Users/donhuvy/.ssh/id_ecdsa type -1
debug1: identity file /Users/donhuvy/.ssh/id_ecdsa-cert type -1
debug1: identity file /Users/donhuvy/.ssh/id_ed25519 type -1
debug1: identity file /Users/donhuvy/.ssh/id_ed25519-cert type -1
debug1: identity file /Users/donhuvy/.ssh/id_xmss type -1
debug1: identity file /Users/donhuvy/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.9
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.4
debug1: match: OpenSSH_7.4 pat OpenSSH_7.0*,OpenSSH_7.1*,OpenSSH_7.2*,OpenSSH_7.3*,OpenSSH_7.4*,OpenSSH_7.5*,OpenSSH_7.6*,OpenSSH_7.7* compat 0x04000002
debug1: Authenticating to 103.48.194.xx:22 as 'root'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:9Ohti7PtCJAN3qMGgBiKh7oBiveKiFy9gHSOI1j3LK8
debug1: Host '103.48.194.xx' is known and matches the ECDSA host key.
debug1: Found key in /Users/donhuvy/.ssh/known_hosts:5
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: Will attempt key: /Users/donhuvy/.ssh/id_rsa RSA SHA256:xpUMQMzX3z6ADCqgmrHzQ7T5GSmDAkVkFVE4aK+3Csc
debug1: Will attempt key: /Users/donhuvy/.ssh/id_dsa 
debug1: Will attempt key: /Users/donhuvy/.ssh/id_ecdsa 
debug1: Will attempt key: /Users/donhuvy/.ssh/id_ed25519 
debug1: Will attempt key: /Users/donhuvy/.ssh/id_xmss 
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Next authentication method: publickey
debug1: Offering public key: /Users/donhuvy/.ssh/id_rsa RSA SHA256:xpUMQMzX3z6ADCqgmrHzQ7T5GSmDAkVkFVE4aK+3Csc
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Trying private key: /Users/donhuvy/.ssh/id_dsa
debug1: Trying private key: /Users/donhuvy/.ssh/id_ecdsa
debug1: Trying private key: /Users/donhuvy/.ssh/id_ed25519
debug1: Trying private key: /Users/donhuvy/.ssh/id_xmss
debug1: Next authentication method: password
[email protected]'s password: 
debug1: Authentication succeeded (password).
Authenticated to 103.48.194.xx ([103.48.194.xx]:22).
debug1: channel 0: new [client-session]
debug1: Requesting [email protected]
debug1: Entering interactive session.
debug1: pledge: network
debug1: client_input_global_request: rtype [email protected] want_reply 0
debug1: Sending environment.
debug1: Sending env LC_CTYPE = UTF-8
debug1: Sending env LC_ALL = en_US.UTF-8
debug1: Sending env LANG = en_US.UTF-8
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype [email protected] reply 0
Last failed login: Fri Feb 22 23:54:05 EST 2019 from 113.119.xxx.21 on ssh:notty
There were 6 failed login attempts since the last successful login.
Last login: Fri Feb 22 23:38:47 2019 from 14.232.141.136
/bin/bash: No such file or directory
debug1: channel 0: free: client-session, nchannels 1
Connection to 103.48.194.xx closed.
Transferred: sent 2532, received 2756 bytes, in 0.1 seconds
Bytes per second: sent 26858.7, received 29234.9
debug1: Exit status 1

尝试通过 SFTP 连接

➜  source_code sftp -v [email protected]
OpenSSH_7.9p1, LibreSSL 2.7.3
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 48: Applying options for *
debug1: Connecting to 103.48.194.xx [103.48.194.xx] port 22.
debug1: Connection established.
debug1: identity file /Users/donhuvy/.ssh/id_rsa type 0
debug1: identity file /Users/donhuvy/.ssh/id_rsa-cert type -1
debug1: identity file /Users/donhuvy/.ssh/id_dsa type -1
debug1: identity file /Users/donhuvy/.ssh/id_dsa-cert type -1
debug1: identity file /Users/donhuvy/.ssh/id_ecdsa type -1
debug1: identity file /Users/donhuvy/.ssh/id_ecdsa-cert type -1
debug1: identity file /Users/donhuvy/.ssh/id_ed25519 type -1
debug1: identity file /Users/donhuvy/.ssh/id_ed25519-cert type -1
debug1: identity file /Users/donhuvy/.ssh/id_xmss type -1
debug1: identity file /Users/donhuvy/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.9
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.4
debug1: match: OpenSSH_7.4 pat OpenSSH_7.0*,OpenSSH_7.1*,OpenSSH_7.2*,OpenSSH_7.3*,OpenSSH_7.4*,OpenSSH_7.5*,OpenSSH_7.6*,OpenSSH_7.7* compat 0x04000002
debug1: Authenticating to 103.48.194.xx:22 as 'root'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:9Ohti7PtCJAN3qMGgBiKh7oBiveKiFy9gHSOI1j3LK8
debug1: Host '103.48.194.34' is known and matches the ECDSA host key.
debug1: Found key in /Users/donhuvy/.ssh/known_hosts:5
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: Will attempt key: /Users/donhuvy/.ssh/id_rsa RSA SHA256:xpUMQMzX3z6ADCqgmrHzQ7T5GSmDAkVkFVE4aK+3Csc
debug1: Will attempt key: /Users/donhuvy/.ssh/id_dsa 
debug1: Will attempt key: /Users/donhuvy/.ssh/id_ecdsa 
debug1: Will attempt key: /Users/donhuvy/.ssh/id_ed25519 
debug1: Will attempt key: /Users/donhuvy/.ssh/id_xmss 
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Next authentication method: publickey
debug1: Offering public key: /Users/donhuvy/.ssh/id_rsa RSA SHA256:xpUMQMzX3z6ADCqgmrHzQ7T5GSmDAkVkFVE4aK+3Csc
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Trying private key: /Users/donhuvy/.ssh/id_dsa
debug1: Trying private key: /Users/donhuvy/.ssh/id_ecdsa
debug1: Trying private key: /Users/donhuvy/.ssh/id_ed25519
debug1: Trying private key: /Users/donhuvy/.ssh/id_xmss
debug1: Next authentication method: password
[email protected]'s password: 
debug1: Authentication succeeded (password).
Authenticated to 103.48.194.xx ([103.48.194.xx]:22).
debug1: channel 0: new [client-session]
debug1: Requesting [email protected]
debug1: Entering interactive session.
debug1: pledge: network
debug1: client_input_global_request: rtype [email protected] want_reply 0
debug1: Sending environment.
debug1: Sending env LC_CTYPE = UTF-8
debug1: Sending env LC_ALL = en_US.UTF-8
debug1: Sending env LANG = en_US.UTF-8
debug1: Sending subsystem: sftp
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype [email protected] reply 0
debug1: channel 0: free: client-session, nchannels 1
debug1: fd 0 clearing O_NONBLOCK
Transferred: sent 2244, received 2468 bytes, in 0.1 seconds
Bytes per second: sent 19786.3, received 21761.4
debug1: Exit status 1
Connection closed

我仍然可以通过 Web 控制台访问服务器(root 帐户)。

我需要从 macOS 连接到 SSH、SFTP。

相关内容