加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

linux – 当我使用SSH登录我的服务器时,显示了两个MOTD

发布时间:2020-12-14 02:40:47 所属栏目:Linux 来源:网络整理
导读:我想更改登录到TTY上的计算机时显示的MOTD,这似乎有效,但不知何故,它不只是在/ etc / motd和/etc/update-motd.d/中显示MOTD,还有另一条消息. 登录到我的服务器时显示: sam@laptop:~$ssh user@serverWelcome to Ubuntu 12.04.2 LTS (GNU/Linux 2.6.32-042sta
我想更改登录到TTY上的计算机时显示的MOTD,这似乎有效,但不知何故,它不只是在/ etc / motd和/etc/update-motd.d/中显示MOTD,还有另一条消息.

登录到我的服务器时显示:

sam@laptop:~$ssh <user>@<server>
Welcome to Ubuntu 12.04.2 LTS (GNU/Linux 2.6.32-042stab068.8 i686)

 * Documentation:  https://help.ubuntu.com/
No mail.
Last login: Thu Feb 21 19:20:55 2013 from <ip>
Welcome to Ubuntu 12.04.2 LTS (GNU/Linux 2.6.32-042stab068.8 i686)

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

<user>@<server>:~$

我的update-motd.d包含两个文件,00-header和10-help-text.

00-header包含以下内容:

[ -r /etc/lsb-release ] && . /etc/lsb-release

if [ -z "$DISTRIB_DESCRIPTION" ] && [ -x /usr/bin/lsb_release ]; then
        # Fall back to using the very slow lsb_release utility
        DISTRIB_DESCRIPTION=$(lsb_release -s -d)
fi

printf "Welcome to %s (%s %s %s)n" "$DISTRIB_DESCRIPTION" "$(uname -o)" "$(uname -r)"     "$(uname -m)"

10-help-text包含:

[ -r /etc/lsb-release ] && . /etc/lsb-release

if [ -z "$DISTRIB_RELEASE" ] && [ -x /usr/bin/lsb_release ]; then
    # Fall back to using the very slow lsb_release utility
    DISTRIB_RELEASE=$(lsb_release -sr)
fi

URL="https://help.ubuntu.com/"
if uname -r | grep -qs "-server"; then
    URL="https://help.ubuntu.com/$DISTRIB_RELEASE/serverguide/C"
fi

printf "n * Documentation:  %sn" "$URL"

这将弥补MOTD的部分,直到没有邮件..但其余部分来自哪里?

解决方法

MOTD既可以通过sshd打印,也可以通过PAM打印.两者都可能正在这样做.

检查/ etc / ssh / sshd_config以获取以下信息:

PrintMotd yes

如果该行不存在,则可能默认为yes(尽管Debian / Ubuntu将默认值更改为no).

检查/etc/pam.d/中的PAM配置,了解以下内容:

session    optional     pam_motd.so

尝试一次禁用这些,以查看更改.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读