1

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:
welcome message

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

Community
  • 1
  • 1
iBadGamer
  • 566
  • 6
  • 22
  • If you need just non-variable MOTD, you should name the file as `/etc/motd` (without the tcl) extension. – Jakuje Oct 11 '15 at 09:54
  • I have variables but this is an exemple – iBadGamer Oct 11 '15 at 10:47
  • Does your system use `systemd` or you use old `init` scripts? Preferred way is to use pam_motd` if you need to modify `motd` for login. Anyway if you consider you found the solution, answer the question and do not edit it. – Jakuje Oct 11 '15 at 12:24

1 Answers1

0

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.

SeinopSys
  • 8,787
  • 10
  • 62
  • 110