Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ssh 启动时不显示自定义motd.tcl_Ssh_Terminal_Debian_Welcome File - Fatal编程技术网

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

Ssh 启动时不显示自定义motd.tcl,ssh,terminal,debian,welcome-file,Ssh,Terminal,Debian,Welcome File,为了修改服务器的ssh欢迎消息,我遵循了以下步骤,但是当我使用ssh时,我根本没有消息 以下是一些信息: /etc/motd.tcl是可执行的 ➜ ~ ls -l /etc/motd.tcl -rwxr-xr-x 1 root root 3687 oct. 11 10:31 /etc/motd.tcl ➜ ~ sudo cat /etc/profile | grep motd /etc/motd.tcl /etc/motd.tcl位于/etc/profile的末尾 ➜ ~ l

为了修改服务器的ssh欢迎消息,我遵循了以下步骤,但是当我使用ssh时,我根本没有消息

以下是一些信息:

/etc/motd.tcl是可执行的

➜  ~  ls -l /etc/motd.tcl 
-rwxr-xr-x 1 root root 3687 oct.  11 10:31 /etc/motd.tcl
➜  ~  sudo cat /etc/profile | grep motd
/etc/motd.tcl
/etc/motd.tcl位于/etc/profile的末尾

➜  ~  ls -l /etc/motd.tcl 
-rwxr-xr-x 1 root root 3687 oct.  11 10:31 /etc/motd.tcl
➜  ~  sudo cat /etc/profile | grep motd
/etc/motd.tcl
/etc/motd.tcl显示我的欢迎信息,没有任何错误:

My/etc/ssh/sshd\u config包含以下行:

PrintMotd yes
PrintLastLog no
也许教程已经过时了,我不得不改变一些东西,但我没有找到相关信息

谢谢你的提示


编辑:问题似乎是由于zsh/oh my zsh,因为当我使用根帐户(没有zsh shell)登录时,教程中会显示motd

,其中有以下部分:

# * 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
}

我已经用
置于
返回0
之前验证过,当我登录并显示MOTD时,如果执行了
,将阻止脚本的其余部分输出任何内容。删除这些行,它将按预期工作。

在本教程中,有以下部分:

# * 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
}

我已经用
置于
返回0
之前验证过,当我登录并显示MOTD时,如果执行了
,将阻止脚本的其余部分输出任何内容。删除这些行,它将按预期工作。

如果您只需要非变量MOTD,则应将文件命名为
/etc/MOTD
(不带tcl)扩展名。我有变量,但这是一个示例,您的系统使用
systemd
还是使用旧的
init
脚本?如果需要修改
motd
进行登录,首选方法是使用pam_motd`。无论如何,如果你认为你找到了解决方案,回答问题,不要编辑它。如果你只需要非变量MOTD,你应该把文件命名为<代码> /ETC/MOTD/<代码>(没有TCL)扩展。我有变量,但是这是一个例子,你的系统使用<代码> StReD < /Cord>或者你使用旧的代码> init < /Cord>脚本?如果需要修改
motd
进行登录,首选方法是使用pam_motd`。无论如何,如果你认为你找到了解决方案,回答问题,不要编辑它。