SSH Secure File Transfer 传文件出问题

来源:互联网 发布:淘宝外卖商家服务费 编辑:程序博客网 时间:2024/05/22 03:40

 

SSH Secure File Transfer 传文件出问题

用SSH Secure File Transfer 传文件时总是出错,提示信息为: 

"File transfer server could not be started or it exited unexpectedly. 
Exit value 0 was returned. Most likely the sftp-server is not in the path of the user on the server-side." 
解决办法:
罪魁祸首就是.bashrc文件。[break] 
在bash的联机手册里有一段,说的是关于通过RSHD登录系统时,系统要执行.bashrc文件。而这 个文件是在启动一个交互SHELL时才要执行的。而在SSH登录时,系统就要执行.bashrc文件。而SSH登录系统是非交互的。如果执 行.bashrc文件时,产生输入与输出就会出在我遇到的这个问题。 
解决办法是:在.bashrc文件中,测试一下是交互SHELL还是非交互的,如果是非交互的,则直接退出即可。 
一般在.bashrc文件的最前边加入下面这行就可以了: 
[ -z "$PS1" ] && return 
或者: 
[ $- != *i* ] && return

 

原创粉丝点击