



最近遇到了通过 ssh 能正常访问服务器,但使用 sftp、scp 失败的情况,最终发现:
如果进行 Shell 初始化时,在为非交互式会话进行了输出(.profile
,.bashrc
,.cshrc
等),则 sftp / scp 在连接时可能会失败。这是因为这些输出使 sftp / scp 客户端发生了混淆。可以通过执行以下命令来验证 Shell 是否存在这个问题:
$ ssh yourhost /usr/bin/true
如果以上命令产生任何输出,那么需要修改 Shell 初始化。
参考资料:
(完)
网友评论