3

When I log in using SSH or after pressing Ctrl+Alt+F1, it takes several seconds after I enter my password to finally show the following:

Welcome to Ubuntu 16.04 LTS (GNU/Linux 4.4.0-28-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

0 packages can be updated.
0 updates are security updates.

Last login: Thu Jan  1 00:00:00 1970
Unable to connect to X server
Unable to connect to X server

user@host:~$ 

What is it doing that causes it to take several seconds to get to a shell prompt? How can I speed it up?

Olathe
  • 4,200
  • 2
  • 17
  • 24
  • This usually happens because of resolv.conf issues. What is the domain name of your server? Can it reach that? It is trying to resolv root controllers – dedunu Mar 24 '18 at 03:50
  • UseDNS=no is the solution for this problem. Change sshd_config. – dedunu Mar 24 '18 at 03:52

1 Answers1

0

"What is it doing that causes it to take several seconds to get to a shell prompt?"

It's using RSA to establish a secure, authenticated connection, and then does a Diffie-Hellman ratchet to establish forward security by generating a one-time key. So there's a good deal of security overhead with SSH.

Alcuin Arundel
  • 3,040
  • 2
  • 20
  • 28
  • 1
    That wouldn't affect the loading of a local TTY, though, would it? OP said when they press Ctrl+Alt+F1 it takes several seconds to load the command prompt after they enter their password. I'm thinking it has something to do with the `Unable to connect to X server` errors. – Nick Weinberg Jul 10 '16 at 21:26
  • Maybe, but I experience a similar delay when I ssh into my server, and I get no such errors. – Alcuin Arundel Jul 10 '16 at 21:36
  • I don't think this is a bad answer, since it does apply to a lot of people who would ask about a delay, but SSH only takes a short while longer than the text console (Ctrl+Alt+F1) to log in and then both take several seconds to get to the shell prompt for me. – Olathe Jul 10 '16 at 23:07