ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Fix Slow SSH/SFTP Logins on Ubuntu

    IT Discussion
    linux ssh ubuntu
    2
    3
    901
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • wrx7mW
      wrx7m
      last edited by wrx7m

      This may seem super trivial for some of your Linux veterans, but I am working through a couple of projects that are broadening my Linux skill set. I ran into an issue where I would try to connect via SSH to an Ubuntu server, running OpenSSH and when logging in, it would take about 10 seconds to prompt for the password and about 30 seconds to complete the login after authenticating me. This also affected trying to use SFTP via filezilla to grab a file from the server.

      After some Googling and trial and error, I found that what fixed my problem was to add a line to the sshd_config file that apparently disables the default behavior of trying to use reverse IP resolution.

      The steps I took:

      • sudo nano /etc/ssh/ssh_config

      • Add this line to the end of the file:
        UseDNS no

      • Ctrl X to exit.

      • Y to save.

      • "Enter" to overwrite the existing file.

      • I restarted the SSH service but I don't know if it was necessary.
        sudo service ssh restart

      scottalanmillerS 1 Reply Last reply Reply Quote 2
      • scottalanmillerS
        scottalanmiller
        last edited by

        Yeah, DNS lookups are a killer for SSH. Almost nothing that people use as an end point has a PTR record and so it always waits for a time out.

        1 Reply Last reply Reply Quote 0
        • scottalanmillerS
          scottalanmiller @wrx7m
          last edited by

          @wrx7m said:

          • I restarted the SSH service but I don't know if it was necessary.
            sudo service ssh restart

          It is.

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          • First post
            Last post