输入密码后 ssh 连接立即关闭

输入密码后 ssh 连接立即关闭

输入密码后 ssh 连接立即关闭

ssh -v [email protected]
OpenSSH_8.1p1, LibreSSL 2.7.3
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 47: Applying options for *
debug1: Connecting to 104.238.125.233 [104.238.125.233] port 22.
debug1: Connection established.
debug1: identity file /Users/nicole/.ssh/id_rsa type -1
debug1: identity file /Users/nicole/.ssh/id_rsa-cert type -1
debug1: identity file /Users/nicole/.ssh/id_dsa type -1
debug1: identity file /Users/nicole/.ssh/id_dsa-cert type -1
debug1: identity file /Users/nicole/.ssh/id_ecdsa type -1
debug1: identity file /Users/nicole/.ssh/id_ecdsa-cert type -1
debug1: identity file /Users/nicole/.ssh/id_ed25519 type -1
debug1: identity file /Users/nicole/.ssh/id_ed25519-cert type -1
debug1: identity file /Users/nicole/.ssh/id_xmss type -1
debug1: identity file /Users/nicole/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH_5* compat 0x0c000002
debug1: Authenticating to 104.238.125.233:22 as 'hoogw'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: diffie-hellman-group-exchange-sha256
debug1: kex: host key algorithm: ssh-rsa
debug1: kex: server->client cipher: aes128-ctr MAC: [email protected] compression: none
debug1: kex: client->server cipher: aes128-ctr MAC: [email protected] compression: none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(2048<3072<8192) sent
debug1: got SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: got SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: ssh-rsa SHA256:z9djZdxvUnzM6SLpcFo6INz6ixj3YFIF+dM/h3+JHh4
debug1: Host '104.238.125.233' is known and matches the RSA host key.
debug1: Found key in /Users/nicole/.ssh/known_hosts:1
debug1: rekey out after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 4294967296 blocks
debug1: Will attempt key: /Users/nicole/.ssh/id_rsa 
debug1: Will attempt key: /Users/nicole/.ssh/id_dsa 
debug1: Will attempt key: /Users/nicole/.ssh/id_ecdsa 
debug1: Will attempt key: /Users/nicole/.ssh/id_ed25519 
debug1: Will attempt key: /Users/nicole/.ssh/id_xmss 
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Next authentication method: publickey
debug1: Trying private key: /Users/nicole/.ssh/id_rsa
debug1: Trying private key: /Users/nicole/.ssh/id_dsa
debug1: Trying private key: /Users/nicole/.ssh/id_ecdsa
debug1: Trying private key: /Users/nicole/.ssh/id_ed25519
debug1: Trying private key: /Users/nicole/.ssh/id_xmss
debug1: Next authentication method: password
[email protected]'s password: 
debug1: Authentication succeeded (password).
Authenticated to 104.238.125.233 ([104.238.125.233]:22).
debug1: channel 0: new [client-session]
debug1: Requesting [email protected]
debug1: Entering interactive session.
debug1: pledge: network
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
Last login: Fri Apr 24 14:10:52 2020 from 097-090-197-218.res.spectrum.com
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
Connection to 104.238.125.233 closed.
Transferred: sent 2600, received 2656 bytes, in 0.1 seconds
Bytes per second: sent 19405.6, received 19823.6
debug1: Exit status 0
nicole@nicoles-iMac ~ % 

答案1

我认为exit 0你的.bash_profile.这似乎是你遇到麻烦的原因。

.bash_profile当您登录到远程终端时首先执行。

尝试运行此命令,让我们知道问题是否仍然存在 -

# ssh [email protected] sed -i '/exit\ 0/d' .bashrc .bash_profile

相关内容