Ubuntu 14.04 上没有 MOTD ......?

alx*_*lvt 13 ssh motd

我最近重新安装了 Ubuntu 14.04。当我使用 SSH 时,没有 MOTD(是的,我在 sshd_config 中设置了适当的命令)。

我读了一堆关于设置 MOTD 的教程,但我意识到虽然我有 /etc/update-motd.d,但没有 /etc/motd 文件,也没有 /var/run/motd 文件。

如何设置这些以便我可以通过 SSH 获得 MOTD?

Ala*_*ith 15

在 Ubuntu 14.04.2 LTS 的基础安装中,只需将您想要的消息放入:

/etc/motd
Run Code Online (Sandbox Code Playgroud)

默认情况下,MOTD 将出现在其他动态 MOTD 内容的末尾。例如,以下是 Vagrant ubuntu/trusty64 (v20150506.0.0) 框的输出,其中添加了 /etc/motd 文件:

$ vagrant ssh
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 May 14 20:06:56 UTC 2015

  System load:  0.39              Processes:           78
  Usage of /:   2.8% of 39.34GB   Users logged in:     0
  Memory usage: 24%               IP address for eth0: 10.0.2.15
  Swap usage:   0%

  Graph this data and manage this system at:
    https://landscape.canonical.com/

  Get cloud support with Ubuntu Advantage Cloud Guest:
    http://www.ubuntu.com/business/services/cloud

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


#####################################
Howdy! This message is from /etc/motd
#####################################

Last login: Thu May 14 20:06:56 2015 from 10.0.2.2
vagrant@vagrant-ubuntu-trusty-64:~$
Run Code Online (Sandbox Code Playgroud)

如果您在使用默认设置的系统上工作,这就是全部。


其他一些故障排除说明:

  • 使用“/etc/motd”是对早期版本的更改。12.02 的建议是使用“/etc/motd.tail”。这在 14.04.2 中不起作用。

  • 我看到的其他建议包括更改“/etc/ssh/sshd_config”中的一些值。如果这些已被更改,以下是有效的默认值:

    UsePAM yes
    PrintMotd no
    
    Run Code Online (Sandbox Code Playgroud)
  • 同样,这里是/etc/pam.d/login我见过的引用的默认值:

    session    optional   pam_motd.so  motd=/run/motd.dynamic noupdate
    session    optional   pam_motd.so
    
    Run Code Online (Sandbox Code Playgroud)

这就是我所看到的用于故障排除的所有内容。