简体   繁体   English

自定义motd.tcl在启动时不显示

[英]Custom motd.tcl does not show at startup

I follow this tutorial in order to modify the ssh welcome message of my server, but when I ssh, I have no message at all... 我按照本教程来修改服务器的ssh欢迎消息,但是当我使用ssh时,我根本没有消息...

Here is some informations: 以下是一些信息:

/etc/motd.tcl is executable /etc/motd.tcl是可执行的

➜  ~  ls -l /etc/motd.tcl 
-rwxr-xr-x 1 root root 3687 oct.  11 10:31 /etc/motd.tcl

/etc/motd.tcl is at the end of /etc/profile /etc/motd.tcl位于/ etc / profile的末尾

➜  ~  sudo cat /etc/profile | grep motd
/etc/motd.tcl

/etc/motd.tcl displays my welcome message without any errors: /etc/motd.tcl显示我的欢迎消息,没有任何错误:
欢迎留言

My /etc/ssh/sshd_config contains the following lines: 我的/ etc / ssh / sshd_config包含以下几行:

PrintMotd yes
PrintLastLog no

Maybe the tutorial is outdated and I have to change something but I did not manage to find the information. 也许该教程已经过时,我必须进行一些更改,但是我没有找到信息。

Thanks for any hints. 感谢您的任何提示。

Edit: Issue seems to be due to zsh/oh-my-zsh because when I log in with the root account (which does not have zsh shell) the motd is displayed 编辑:问题似乎是由于zsh / oh-my-zsh所致,因为当我使用root帐户(没有zsh shell)登录时,会显示motd

In the tutorial, there's this section: 在本教程中,有以下部分:

# * Check if we're somewhere in /home
#if {![string match -nocase "/home*" $var(path)]} {
if {![string match -nocase "/home*" $var(path)] && ![string match -nocase "/usr/home*" $var(path)] } {
  return 0
}

I've verified with a puts before return 0 that when I log in and the MOTD would be shown, this if gets executed, preventing the rest of the script from outputting anything. 我已经用return 0之前的puts进行了验证,该密码在我登录并显示MOTD时会显示, if执行, if阻止脚本的其余部分输出任何内容。 Remove these lines and it should work as expected. 删除这些行,它将按预期工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM