简体   繁体   中英

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...

Here is some informations:

/etc/motd.tcl is executable

➜  ~  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

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

/etc/motd.tcl displays my welcome message without any errors:
欢迎留言

My /etc/ssh/sshd_config contains the following lines:

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

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. Remove these lines and it should work as expected.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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