当 ssh 连接到服务器时,如何禁用问候消息?
How can I disable greeting message when ssh in to a server?
每次 - 我 ssh
进入我的服务器我不断得到
ssh root@12.34.56.78
Welcome to Ubuntu 14.04.2 LTS (GNU/Linux 3.13.0-52-generic x86_64)
* Documentation: https://help.ubuntu.com/
System information as of Thu Jul 2 10:58:35 EDT 2015
System load: 0.16 Processes: 90
Usage of /: 13.5% of 19.56GB Users logged in: 0
Memory usage: 25% IP address for eth0: 12.34.56.78
Swap usage: 0% IP address for eth1: 10.10.10.10
Graph this data and manage this system at:
https://landscape.canonical.com/
Last login: Thu Jul 2 10:58:35 2015 from 50-198-81-174-static.hfc.comcastbusiness.net
第一次登录服务器就显示没问题。
但是一直看到这条消息,我觉得有点没必要。
有人可以告诉我如何禁用它吗?
如果是您自己的服务器,最明智的解决方案是在 SSH 守护程序配置中禁用 motd。将 /etc/ssh/sshd_config
中的 PrintMotd
设置为 no
并重新启动 ssh 守护进程。
或者,您可以尝试 touch ~/.hushlogin
,这会在您的个人文件夹中创建一个空文件。允许远程登录的守护进程通常会检查此文件是否存在,如果存在,它们会让您安静地登录。
或者,如果 motd 设置为 no
,并且您不想使用 .hushlogin,您可以编辑 /etc/motd
或 /etc/update-motd.d/*
并擦除它的内容,所以您仍然会收到“上次登录”消息的通知。
在文件中 /etc/pam.d/sshd
- 注释这两行:
之前:
session optional pam_motd.so motd=/run/motd.dynamic
session optional pam_motd.so noupdate
之后:
#session optional pam_motd.so motd=/run/motd.dynamic
#session optional pam_motd.so noupdate
每次 - 我 ssh
进入我的服务器我不断得到
ssh root@12.34.56.78
Welcome to Ubuntu 14.04.2 LTS (GNU/Linux 3.13.0-52-generic x86_64)
* Documentation: https://help.ubuntu.com/
System information as of Thu Jul 2 10:58:35 EDT 2015
System load: 0.16 Processes: 90
Usage of /: 13.5% of 19.56GB Users logged in: 0
Memory usage: 25% IP address for eth0: 12.34.56.78
Swap usage: 0% IP address for eth1: 10.10.10.10
Graph this data and manage this system at:
https://landscape.canonical.com/
Last login: Thu Jul 2 10:58:35 2015 from 50-198-81-174-static.hfc.comcastbusiness.net
第一次登录服务器就显示没问题。 但是一直看到这条消息,我觉得有点没必要。
有人可以告诉我如何禁用它吗?
如果是您自己的服务器,最明智的解决方案是在 SSH 守护程序配置中禁用 motd。将 /etc/ssh/sshd_config
中的 PrintMotd
设置为 no
并重新启动 ssh 守护进程。
或者,您可以尝试 touch ~/.hushlogin
,这会在您的个人文件夹中创建一个空文件。允许远程登录的守护进程通常会检查此文件是否存在,如果存在,它们会让您安静地登录。
或者,如果 motd 设置为 no
,并且您不想使用 .hushlogin,您可以编辑 /etc/motd
或 /etc/update-motd.d/*
并擦除它的内容,所以您仍然会收到“上次登录”消息的通知。
在文件中 /etc/pam.d/sshd
- 注释这两行:
之前:
session optional pam_motd.so motd=/run/motd.dynamic
session optional pam_motd.so noupdate
之后:
#session optional pam_motd.so motd=/run/motd.dynamic
#session optional pam_motd.so noupdate