登录时 MOTD 末尾出现奇怪的消息

登录时 MOTD 末尾出现奇怪的消息

我有一台运行 Ubuntu 18.04 的服务器,每当我通过 SSH 登录时,我都会在 MOTD 末尾收到此信息:

Command 'syncthing' is available in '/snap/bin/syncthing'
The command could not be located because '/snap/bin' is not included in the PATH environment variable.
syncthing: command not found

我确实在服务器上设置了 Syncthing(通过 安装snap),但我使用在屏幕会话中启动它的脚本来运行它(我手动运行此脚本,据我所知它不应该自动运行)。我可以在哪里检查它为什么会尝试运行?我检查过了,.bashrc但那里没有任何条目。任何帮助都非常感谢。

编辑:

运行 Terdon 评论中的第一个建议没有任何效果,而第二条命令则打印了以下内容:

etc/profile.d/01-locale-fix.sh:syncthing

我打开了该文件,果然有一行syncthing。我注释掉了那一行,注销并重新登录,问题就解决了。

答案1

每当在 shell 初始化过程中出现类似这样的怪事时,你的第一步应该是检查 shell 在启动时读取的所有文件。由于各种不同类型的 (bash) shell读取不同的文件syncthing,您可以使用此命令在所有可能相关的文件中查找字符串:

grep syncthing ~/.bashrc ~/.profile ~/.bash_profile ~/bash.login \ 
               ~/.bash_aliases /etc/bash.bashrc /etc/profile \ 
               /etc/profile.d/* /etc/environment 2> /dev/null.

对于您来说,有问题的文件是 中的一个文件/etc/profile.d,因此只需删除或注释掉相关行,就可以开始了!

相关内容