2

I have a problem with ssh connection. I am using my Ubuntu 16.04 client to connect to the Centos7 server. I use ssh-key pairs to establish connections. But then a lot of weird things happen: Sometimes I can connect to the server without problems, sometimes it throws a Timeout error. Sometimes on the server it just does not respond to keyboard inputs. First I thought that it was related to the server. But tested the connection on windows 10 using putty. And it went without any problems. Also I experienced this with AWS servers. So I think it is related to my Ubuntu client. Because from the PuTTY it all goes perfect.

Also: I went with some unsuccessful tries to server. But from the top command (using Windows Server) I see connections which hang.

enter image description here

My settings for connecting taken from /etc/ssh/ssh_config and ~/.ssh/config (I removed which are commented with #)

Host *
    HashKnownHosts yes
    GSSAPIAuthentication yes
    GSSAPIDelegateCredentials no
    KeepAlive yes
    TCPKeepAlive yes
    ServerAliveInterval 60
    ServerAliveCountMax 5
    GSSAPIAuthentication no

Here is not a successful attempt to connect

debug1: Authentication succeeded (publickey).
Authenticated to 91.92.128.50 ([91.92.128.50]:22).
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 no-more-sessions@openssh.com
debug3: send packet: type 80
debug1: Entering interactive session.
debug1: pledge: network
debug3: receive packet: type 80
debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0
debug3: receive packet: type 91
debug2: callback start
debug2: fd 3 setting TCP_NODELAY
debug3: ssh_packet_set_tos: set IP_TOS 0x10
debug2: client_session2_setup: id 0
debug2: channel 0: request pty-req confirm 1
debug3: send packet: type 98
debug2: channel 0: request shell confirm 1
debug3: send packet: type 98
debug2: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug3: send packet: type 80
debug3: send packet: type 80
debug3: send packet: type 80
debug3: send packet: type 80
debug3: send packet: type 80
Timeout, server 91.92.128.50 not responding.

Sometimes when my session hangs and I am on the server I get these notifications in the terminal. (I connected with the -vvv option)

[aeliv@v20920 ~]$ debug3: send packet: type 80
debug3: receive packet: type 82

[aeliv@v20920 ~]$ 
[aeliv@v20920 ~]$ debug3: send packet: type 80
debug3: receive packet: type 82
debug3: send packet: type 80
debug3: send packet: type 80
Dave M
  • 4,514
  • 22
  • 31
  • 30
K.I.
  • 123
  • 1
  • 5
  • See https://unix.stackexchange.com/a/3027/164629 Is it possible that the server has `ClientAliveInterval` disabled (set to 0 or otherwise)? – multithr3at3d Mar 04 '18 at 20:24

1 Answers1

0

If this works, all credit to @Strahinja Kustudic and you can go to https://serverfault.com/a/794789/569013 for more detail. For short You can try systemctl restart systemd-logind to solve the problem.

xiaojueguan
  • 111
  • 3