ssh -v remote_serverThe log showed that there was a pause when ssh client application was trying authentication method gssapi-with-mic. After 3 trials, ssh client tried the next authentication method and succeeded:
debug1: Authentications that can continue: publickey,gssapi-with-mic,password debug1: Next authentication method: gssapi-with-mic debug1: Unspecified GSS failure. Minor code may provide more information No credentials cache found debug1: Unspecified GSS failure. Minor code may provide more information No credentials cache found debug1: Unspecified GSS failure. Minor code may provide more information debug1: Next authentication method: publickeyWe could skip the gssapi-with-mic authentication method and only tried publickey and password by using the PreferredAuthentications options:
ssh -o PreferredAuthentications=publickey,keyboard-interactive remote_serverThe ssh client first tried the private/public authentication method. If failed, it would prompt the user for password. There would be no long pause any more during the connection.
If you don't want to type such a long option in your command line, put it into a configuration file. Create a file ~/.ssh/config in your home directory. Inside the file, add this one line: