Jay*_*hoi 3 ssh centos sshpass
在CentOS 6.3版(最终版)系统上工作.并尝试使用sshpass
实用程序ssh另一台机器
sshpass -p 'password' ssh user@host
Run Code Online (Sandbox Code Playgroud)
但它给我的错误就像
sshpass: Failed to run command: No such file or directory
Run Code Online (Sandbox Code Playgroud)
所以从错误我认为sshpass
可能不是安装所以尝试安装它yum install sshpass
并得到以下日志
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: mirror.leapswitch.com
* epel: epel.mirror.net.in
* extras: mirror.leapswitch.com
* nux-libreoffice.org-rpms: mirror.li.nux.ro
* updates: mirror.leapswitch.com
Setting up Install Process
Package sshpass-1.05-1.el6.i686 already installed and latest version
Nothing to do
Run Code Online (Sandbox Code Playgroud)
从上面看似sshpass已经安装了.所以它为什么不工作?
检查你的shell是否知道sshpass的位置
which sshpass
Run Code Online (Sandbox Code Playgroud)
如果它没有给出任何输出,请使用find命令查找可执行文件的位置:
find / -name sshpass
Run Code Online (Sandbox Code Playgroud)
如果找到路径,则可以使用可执行文件的完整路径:
/path/to/sshnpass
Run Code Online (Sandbox Code Playgroud)
或者添加PATH环境变量的路径,以便shell可以找到它:
export PATH=$PATH:/path/to/
Run Code Online (Sandbox Code Playgroud)
或者问题可能完全不同.sshpass可能无法找到其他依赖项.可能未安装"ssh"客户端.或者您的语法可能有误: