如何在登录 Ubuntu 服务器之前运行 Banner 文件中的命令

如何在登录 Ubuntu 服务器之前运行 Banner 文件中的命令

因此,我需要在 ubuntu 服务器中显示当前时间、日期和登录用户数,我已经编辑了横幅,但无法在其上运行命令。我需要为此运行脚本吗?或者有没有办法在文本文件中运行命令(如横幅文件)?

提前致谢

答案1

在我的 Ubuntu 14.05.5 上,“横幅”或“每日消息”(motd)是通过运行一组脚本生成的。您可以将自己的脚本添加到此过程中。首先阅读man update-motd,其中部分内容如下:

NAME
       update-motd - dynamic MOTD generation

SYNOPSIS
       /etc/update-motd.d/*

DESCRIPTION
       UNIX/Linux system adminstrators often communicate important information
       to console and remote users by maintaining text in the file  /etc/motd,
       which  is  displayed  by  the  pam_motd(8)  module on interactive shell
       logins.

       Traditionally, this file is static text,  typically  installed  by  the
       distribution  and  only  updated on release upgrades, or overwritten by
       the local administrator with pertinent information.

       Ubuntu introduced the update-motd framework, by which  the  motd(5)  is
       dynamically assembled from a collection of scripts at login.

相关内容