设置〜/ .bashrc后FileZilla不工作 [英] After setting ~/.bashrc the FileZilla doesn't work
问题描述
要自动添加ssh键,我编辑了〜/ .bashrc
文件并添加了 eval$(ssh-agent -s) code>和
ssh-add
。
To auto add ssh key I edited the ~/.bashrc
file and added eval "$(ssh-agent -s)"
and ssh-add
at the end. It works well.
这样做后,我无法使用FileZilla通过SFTP访问服务器。
After doing this, I cannot visit the server via SFTP with FileZilla.
我修复这与保持自动运行 ssh-add
?
How can I fix this with keep auto running ssh-add
?
我的服务器操作系统是CentOS 6.7。我也通过shell访问服务器。
My server OS is CentOS 6.7. I also access the server via shell.
推荐答案
回答您的上一个问题¹有问题: eval$(ssh-agent -s)
应该仅对登录shell执行(例如,当您通过常规SSH登录以在服务器的命令行上运行命令时)。
The guy who answered your previous question¹ got something wrong: eval "$(ssh-agent -s)"
should only be executed for login shells (e.g. when you are logging in over regular SSH to run commands on the server's command-line).
其他工具,如FileZilla,可以使用非交互式shell登录,这些工具不需要或不希望SSH代理正在运行。
Other tools, like FileZilla, may log in with non-interactive shells and these tools don't need or want the SSH Agent to be running.
〜/ .bashrc
适用于两种类型的shell,因此不适合开始 ssh-agent
。 〜/ .bash_profile
是一个更好的选择,因为它只适用于登录shell。将 ssh-agent
命令移到那里,一切都应该工作。
~/.bashrc
applies to both types of shells, so it is not the right place to start ssh-agent
. ~/.bash_profile
is a better choice since it only applies to login shells. Move the ssh-agent
command there and everything should work again.
对不起,你错了!我也会更新这个答案。
¹I'm that guy. Sorry for steering you wrong! I'll update that answer too.
这篇关于设置〜/ .bashrc后FileZilla不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!