Linux login shell信息展示类(neofetch、motd等banner类提示信息展示)导致的rsync服务不可用问题注意事项
终端报错信息(以Debian 11 系统为例):protocol version mismatch — is your shell clean?
系统环境
- OS: Debian GNU/Linux 11 (bullseye) x86_64
- Host: KVM RHEL 7.6.0 PC (i440FX + PIIX, 1996)
- Kernel: 5.10.0-22-amd64
问题描述
- 【问题】:导致rsync服务同步失败,报错信息: - "protocol version mismatch — is your shell clean?"。
- 【原因】:rsync等工具非常依赖于shell执行时没有任何输出。 
- 【建议】:不建议在.bashrc中输出neofetch、banner类和motd类提示信息,在~/.profile中source ~/.bashrc可以避免此问题,但需注意 - .profile循环引用执行问题。
login shell载入文件信息相关文件:
| 1 | /etc/profile | 
.profile 引用 .bashrc:
| 1 | if [ "$BASH" ]; then | 
输出展示信息放在~/.bashrc文件内引发的问题(rsync为例):
| 1 | # ~/.bashrc: executed by bash(1) for non-login shells. | 
【问题】:导致rsync服务同步失败,报错信息: "protocol version mismatch — is your shell clean?"。
【原因】:rsync等工具非常依赖于shell执行时没有任何输出。
【建议】:不建议在.bashrc中输出neofetch、banner类和motd类提示信息,在~/.profile中source ~/.bashrc可以避免此问题,但需注意.profile循环引用执行问题。
例如:~/.profile
| 1 | if [ "$BASH" ]; then | 
总结:在Linux发行版系统中,一些高度依赖.bashrc的系统工具或者命令(例如rsync),会引发不可执行或者执行有误等问题,要留意Linux文件加载的顺序以及执行规则。
Linux login shell信息展示类(neofetch、motd等banner类提示信息展示)导致的rsync服务不可用问题注意事项






