V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
skt041959
V2EX  ›  Linux

请教 SSH login 之后立即断连的问题

  •  
  •   skt041959 · 2020-02-06 15:31:23 +08:00 · 4328 次点击
    这是一个创建于 1753 天前的主题,其中的信息可能已经有所发展或是发生改变。

    我起了一个非 root 权限 sshd,想要给 VSCode remote 用。但是 ssh 连接都是 login 成功马上就断了。我贴了 Authentication succeeded 之后的 verbose 输出,麻烦大佬给看一下。
    sshd_config 里面都是除了端口号,都是默认值,这里就不贴了。

    debug1: Authentication succeeded (publickey).
    Authenticated to localhost ([127.0.0.1]:22022).
    debug1: channel 0: new [client-session]
    debug3: ssh_session2_open: channel_new: 0
    debug2: channel 0: send open
    debug3: send packet: type 90
    debug1: Requesting [email protected]
    debug3: send packet: type 80
    debug1: Entering interactive session.
    debug1: pledge: network
    debug3: receive packet: type 80
    debug1: client_input_global_request: rtype [email protected] want_reply 0
    debug3: receive packet: type 4
    debug1: Remote: /home/~/.ssh/authorized_keys:1: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
    debug3: receive packet: type 4
    debug1: Remote: /home/~/.ssh/authorized_keys:1: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
    debug3: receive packet: type 91
    debug2: channel_input_open_confirmation: channel 0: callback start
    debug2: fd 3 setting TCP_NODELAY
    debug3: ssh_packet_set_tos: set IP_TOS 0x20
    debug2: client_session2_setup: id 0
    debug1: Sending command: csh
    debug2: channel 0: request exec confirm 1
    debug3: send packet: type 98
    debug2: channel_input_open_confirmation: channel 0: callback done
    debug2: channel 0: open confirm rwindow 0 rmax 32768
    debug2: channel 0: rcvd adjust 2097152
    debug3: receive packet: type 99
    debug2: channel_input_status_confirm: type 99 id 0
    debug2: exec request accepted on channel 0
    debug3: receive packet: type 98
    debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
    debug3: receive packet: type 98
    debug1: client_input_channel_req: channel 0 rtype [email protected] reply 0
    debug2: channel 0: rcvd eow
    debug2: channel 0: chan_shutdown_read (i0 o0 sock -1 wfd 4 efd 6 [write])
    debug2: channel 0: input open -> closed
    debug3: receive packet: type 96
    debug2: channel 0: rcvd eof
    debug2: channel 0: output open -> drain
    debug2: channel 0: obuf empty
    debug2: channel 0: chan_shutdown_write (i3 o1 sock -1 wfd 5 efd 6 [write])
    debug2: channel 0: output drain -> closed
    debug3: receive packet: type 97
    debug2: channel 0: rcvd close
    debug3: channel 0: will not send data after close
    debug2: channel 0: almost dead
    debug2: channel 0: gc: notify user
    debug2: channel 0: gc: user detached
    debug2: channel 0: send close
    debug3: send packet: type 97
    debug2: channel 0: is dead
    debug2: channel 0: garbage collecting
    debug1: channel 0: free: client-session, nchannels 1
    debug3: channel 0: status: The following connections are open:
      #0 client-session (t4 r0 i3/0 o3/0 e[write]/0 fd -1/-1/6 sock -1 cc -1)
    
    debug3: send packet: type 1
    debug3: fd 1 is not O_NONBLOCK
    Transferred: sent 2708, received 2980 bytes, in 0.0 seconds
    Bytes per second: sent 60909.1, received 67027.0
    debug1: Exit status 1
    
    2 条回复    2020-02-07 01:46:51 +08:00
    buzailianxi
        1
    buzailianxi  
       2020-02-06 19:54:16 +08:00
    .bashrc 里面看看。有时候中毒了就会里面有条推出指令。ssh 登陆时立即执行里面的推出就会无法登陆。

    ssh [email protected] "rm /home/ubuntu/.bashrc"
    shellus
        2
    shellus  
       2020-02-07 01:46:51 +08:00
    这种情况十有八九都是网络问题
    试试用其他地方的 vps 去连接看看
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1085 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 23:29 · PVG 07:29 · LAX 15:29 · JFK 18:29
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.