码迷,mamicode.com
首页 > 其他好文 > 详细

rysnc,scp与bashrc冲突问题

时间:2015-12-03 13:42:34      阅读:168      评论:0      收藏:0      [点我收藏+]

标签:

问题是:

scp file user@host:dst失败,user用户的bashrc文件中加入了 sudo su -,自动切换到root用户。

症状是输入密码验证失败。

 

 

 

rsync, scp是传输文件的工具,会用到stdin和stdout。

login bash会自动执行bashrc中的命令,如果bashrc的命令会输出内容到stdout,需要要求是clean bash。

参考https://rsync.samba.org/FAQ.html#3

is your shell clean

The "is your shell clean" message and the "protocol mismatch" message are usually caused by having some sort of program in your .cshrc, .profile, .bashrc or equivalent file that writes a message every time you connect using a remote-shell program (such as ssh or rsh). Data written in this way corrupts the rsync data stream. rsync detects this at startup and produces those error messages. However, if you are using rsync-daemon syntax (host::path or rsync://) without using a remote-shell program (no --rsh or -e option), there is not remote-shell program involved, and the problem is probably caused by an error on the daemon side (so check the daemon logs).

A good way to test if your remote-shell connection is clean is to try something like this (use ssh or rsh, as appropriate):

ssh remotesystem /bin/true > test.dat

That should create a file called test.dat with nothing in it. If test.dat is not of zero length then your shell is not clean. Look at the contents of test.dat to see what was sent. Look at all the startup files on remotesystem to try and find the problem.

 

rysnc,scp与bashrc冲突问题

标签:

原文地址:http://www.cnblogs.com/Torstan/p/5015479.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!