πŸ“– ~1 min read

Table of contents
  1. Symptom & Impact
  2. Environment & Reproduction
  3. Root Cause Analysis
  4. Quick Triage
  5. Step-by-Step Diagnosis
  6. Solution – Primary Fix
  7. Solution – Alternative Approaches
  8. Verification & Acceptance Criteria
  9. Rollback Plan
  10. Prevention & Hardening
  11. Related Errors & Cross-Refs
  12. References & Further Reading

Symptom & Impact

SSH authentication succeeds but initial login takes 10-30 seconds. Automation jobs time out, and administrators perceive random server slowness on Ubuntu 22.04.

Environment & Reproduction

Ubuntu 22.04 LTS using OpenSSH server in networks with incomplete PTR records. Reproduce by connecting from IP addresses lacking reverse DNS entries.

Root Cause Analysis

sshd may perform hostname lookups that stall when DNS PTR queries timeout. Combined with GSSAPI and PAM network calls, this significantly delays session establishment.

Quick Triage

Measure connection timing with verbose SSH output and confirm DNS latency for client IP reverse lookup path.

Step-by-Step Diagnosis

Review sshd logs and configuration for UseDNS, GSSAPIAuthentication, and PAM modules that depend on network identity services.

Illustrative mockup for ubuntu-22-04-lts β€” sshd_reverse_dns_delay
Delayed SSH handshake while waiting for reverse DNS lookup β€” Illustrative mockup β€” Progressive Robot

Solution – Primary Fix

Disable reverse DNS lookups for SSH, optionally disable unused GSSAPI auth, then reload sshd and retest login latency from affected source networks.

Still having issues? Our IT Solutions & Services team can diagnose and resolve this for you. Get in touch for a free consultation.

Illustrative mockup for ubuntu-22-04-lts β€” sshd_usedns_no_fix
Fast SSH login after disabling UseDNS and reloading sshd β€” Illustrative mockup β€” Progressive Robot

Solution – Alternative Approaches

Fix upstream DNS PTR records, deploy local DNS cache, or tune resolver timeout values where reverse lookups are required for audit or policy reasons.

Verification & Acceptance Criteria

SSH interactive login starts within expected threshold, automation scripts stop timing out, and sshd logs show no prolonged pre-auth delays.

Rollback Plan

Re-enable previous sshd settings from backup, reload service, and restore DNS troubleshooting path if disabling UseDNS conflicts with audit requirements.

Prevention & Hardening

Maintain accurate DNS records, validate SSH latency in monitoring, and keep sshd_config standardized across Ubuntu 22.04 estates.

Related to PAM LDAP delays, SSSD cache misses, and slow banner generation from shell initialization scripts on remote login.

Related tutorial: View the step-by-step tutorial for Ubuntu 22.04 LTS.

View all Ubuntu 22.04 LTS tutorials on the Tutorials Hub β†’

Browse all common problems & solutions on the Tutorials Hub.

References & Further Reading

Consult sshd_config(5), Ubuntu OpenSSH server guide, and resolver troubleshooting documentation for reverse DNS behavior.

Need Expert Help?

If you cannot resolve this yourself, our team offers hands-on Server Management, Managed IT Services, and flexible Support Plans. Contact us today β€” we respond within one business day.