a solution to slow ssh connection

in Gentoo linux

Posted by JXLIU on March 5, 2022

the cause of a slow ssh connection

you can use ssh -v to chech why do you have a slow ssh connection

1
ssh -v username@server

If it is stucked on the step pledge: exec

1
2
3
4
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: pledge: exec

then something the elogind or systemd-logind service maybe wrong. If so, restart the service can solve this problem.

how to solve this problem

1
2
3
user@server ~ $ sudo rc-service elogind restart
 * Starting elogind ...
 * start-stop-daemon: /lib64/elogind/elogind is already running       [ !! ] * ERROR: elogind failed to start

If you can not restart it, just kill and then start it.