ssh远程登录ubuntu成功后延迟一段时间进入会话是怎么回事?

ssh远程登录ubuntu成功后延迟一段时间进入会话是怎么回事?

这是因为ssh登录linux时,linux会成功一段文本message,作一个简短的信息报告。

例如:


Welcome to Ubuntu 20.04.6 LTS (GNU/Linux 5.4.0-165-generic x86_64)


 * Documentation:  https://help.ubuntu.com

 * Management:     https://landscape.canonical.com

 * Support:        https://ubuntu.com/advantage


  System information as of Tue 31 Oct 2023 09:37:02 AM CST


  System load:  0.05               Processes:               138

  Usage of /:   62.7% of 68.11GB   Users logged in:         1

  Memory usage: 4%                 IPv4 address for enp0s3: 192.168.1.170

  Swap usage:   0%


 * Strictly confined Kubernetes makes edge and IoT secure. Learn how MicroK8s

   just raised the bar for easy, resilient and secure K8s cluster deployment.


   https://ubuntu.com/engage/secure-kubernetes-at-the-edge


Expanded Security Maintenance for Applications is not enabled.


13 updates can be applied immediately.

13 of these updates are standard security updates.

To see these additional updates run: apt list --upgradable


26 additional security updates can be applied with ESM Apps.

Learn more about enabling ESM Apps service at https://ubuntu.com/esm


New release '22.04.3 LTS' available.

Run 'do-release-upgrade' to upgrade to it.


通常来讲,linux通过/etc/motd中的文本作为输出内容,可能简单的列出一段欢迎语。而ubuntu将motd(message of the day)改为了一个模块,

这样一来,就能通过执行一系列的脚本程序,合成一段动态生成的内容如上面的例子,列出该系统的基本配置、ubuntu的推广信息、该系统的更新包状况、新版本的ubuntu是否可更新等等。

之所以登录成功后延迟,就因为执行这些脚本程序从ubuntu的服务器端获取数据有网络延迟。

如果想要改善这个问题,只需要在/etc/update-motd.d/ 目录中,查看那些脚本程序,将不太重要或者延迟严重的脚本移除即可。