1

In my program, ssh "normally" takes around 0.3s, however sometimes it may take more than 2s.

I wonder whether this is a normal variation for ssh's execution time, and whether there is some thing I can do to get rid of the occasional 2s.

Things I've tried/read about so far:

  1. Disable the use of module pam_systemd in PAM config file /etc/pam.d/system-auth-ac: this does help; I used to bump into extra long ssh execution time of over 15s and disabling pam_systemd fixed this.
  2. Set UseDNS to no(as suggested in it takes too long to connect to ssh server): my default setting in sshd_config is no so I think this is irrelevant to my problem.
  3. Comment out these 2 lines in sshd_config(from this question) :

    GSSAPIAuthentication yes
    GSSAPIDelegateCredentials no
    

    I tried but it didn't help in my case.

  4. SELinux: disabled.

Are there any other suggestions?

Thanks in advance!

Update

I found that the 2s execution time is not due to ssh connection, but due to the command sent through ssh -- so it is not a problem with ssh.

I'd rather not delete this question in hope that the methods I've tried could be of some help.

Thanks!

Rui F Ribeiro
  • 56,709
  • 26
  • 150
  • 232
Clara
  • 159
  • @Rui, the I'd rather not delete this question in hope that the methods I've tried could be of some help. you've removed in your edit helped understand why this Q&A has not been closed. I would agree that the question on its own is useful even if the answer is in the question. – Stéphane Chazelas Apr 18 '19 at 12:17
  • @StéphaneChazelas Rollbacked, thanks. Enough editing now. Have a nice easter. – Rui F Ribeiro Apr 18 '19 at 12:19

1 Answers1

0

Run the SSH client with the -vvv option which will give you an output with max verbosity. In this way you'll be able to see if the delay is due to the client or the server, and where exactly it takes place.

dr_
  • 29,602
  • Yes I've tried -vvv before and compared between the message for the normal ssh and for the 2s ssh, and there seemed to be no obvious distinction (for example they both contained the same GSS failure which I think doesn't matter, and there are no keyword "error"). Could you please maybe name some possible errors? – Clara Aug 19 '15 at 10:41
  • 1
    Well, there are many things that can go wrong but this doesn't seem to be your case. Using max verbosity you should be able to see where it slows down, though. – dr_ Aug 19 '15 at 11:36
  • I think the 2s is due to the execution of command I sent through ssh, so it is not a problem with the connection itself. I've updated the main post. Thank you for your help! – Clara Aug 20 '15 at 03:24