2

I have a problem with ssh connection.
I am using my ubuntu 16.04 client to connect to centos7 server. I use ssh-key pairs to establish connection. But then a lot of weird things happens: Sometimes I can connect to server without problems sometimes it throws Timeout error. Sometimes on server it just does not respond to keyboard inputs.

First I thought that it was related with server. But tested the connection on windows 10 using putty. And it went without any problems. Also I expierenced this with AWS servers. So I think it is related to my ubuntu client. Because from putty it all goes perfect.

Also: I went with some unsucessfull tries to server. But from top command (using windows server) I see connections which hanged. 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 succesfull atempt 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 server I get these some notifications in terminal. (I connected with -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
K.I.
  • 121
  • 1
  • 3
  • 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
  • 2