SSH Login delay

When i login to a server, SSH connection take more than 2 minutes.

boby@sok-01:~$ time ssh root@10.10.1.1 -p 3333 exit

real	2m7.288s
user	0m0.120s
sys	0m0.039s
boby@sok-01:~$

In the server, i disbled UseDNS in /etc/ssh/sshd_config

UseDNS no

This was AlmaLinux server 9 with GSSAPIAuthentication disabled, DIsabled with GSSAPIAuthentication with

cat > /etc/ssh/sshd_config.d/10-tweaks.conf << 'EOF'
GSSAPIAuthentication no
GSSAPICleanupCredentials no
EOF

systemctl restart sshd

Verified it is disabled with

sshd -T | grep -iE "gssapi|pam|usedns|pubkey|password"

When running

journalctl -u sshd -f

Got the error “PAM Error connecting to /opt/i360_pam_imunify/pam_imunify360.sock: Connection refused”, this is resolved by updating immunify360

wget -O imunify-force-update.sh https://repo.imunify360.cloudlinux.com/defence360/imunify-force-update.sh 
bash imunify-force-update.sh

Once this is done, pam related error disappear, but the login still takes time, I got it resolved by running

systemctl daemon-reload
systemctl restart systemd-logind

To see systemd-logind related logs run

journalctl -u systemd-logind --since "5 minutes ago"

sshd pam config located in

cat /etc/pam.d/sshd

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *