Connection to one of my servers using ssh takes more than 20 seconds to initiate.
This is not related to LAN or WAN conditions, since connection to itself takes the same (ssh localhost). After connection is finally establised, it is super fast to interract with the server.
Using -vvv shows that the connection is stuck after saying "pledge: network". At this point, authentication (here using key) is already done, as visible here :
... debug1: Authentication succeeded (publickey). Authenticated to myserver.mydomain.com ([xx.xx.xx.xx]:22). debug1: channel 0: new [client-session] debug2: channel 0: send open debug1: Requesting [email protected] debug1: Entering interactive session. debug1: pledge: network
(...stuck here for 15 to 25 seconds...)
debug1: client_input_global_request: rtype [email protected] want_reply 0 debug2: callback start debug2: fd 3 setting TCP_NODELAY debug2: client_session2_setup: id 0 ...
Server is Ubuntu 16.04. It already happened to me in the past with another server (was Ubuntu 12.04) , nerver found the solution and the problem disapeared after a while...
sshd_config is the default one provided by Ubuntu.
So far I have tried :
- using -o GSSAPIAuthentication=no in the ssh command
- using password instead of a key
- using UsePrivilegeSeparation no instead of yes, in sshd_config