无法在centOS中运行sshpass命令 [英] Unable to run sshpass command in centOS
问题描述
已在CentOS 6.3版(最终版)系统上工作。并尝试使用 sshpass
实用程序ssh另一台计算机,例如
Have work on CentOS release 6.3 (Final) system. And try to ssh another machine using sshpass
utility like
sshpass -p 'password' ssh user@host
但是它给了我类似的错误
But it give me error like
sshpass: Failed to run command: No such file or directory
所以从错误中我认为可能未安装 sshpass
,所以请尝试通过 yum install sshpass $安装它c $ c>并获取以下日志
So from error i think that sshpass
may be not install so have try to install it by yum install sshpass
and get following log
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
从上面看来sshpass已经安装为什么不起作用?
from above it seems sshpass is already installed.So why it not working?
推荐答案
检查您的外壳是否知道sshpass的位置
Check if your shell knows the locations of sshpass
which sshpass
如果没有给出任何输出,使用find命令查找可执行文件的位置:
If it doesnt give any output use find command to find the location of the executable:
find / -name sshpass
如果找到该路径,则可以使用可执行文件的完整路径:
If you find the path, you can either use the full path of the executable:
/path/to/sshnpass
或添加PATH环境变量的路径,以便您的外壳程序可以找到它:
Or add the path to the PATH environmental variable, so that your shell can locate it:
export PATH=$PATH:/path/to/
或者问题可能完全不同。 sshpass可能找不到其他依赖项。可能未安装 ssh客户端。否则您的语法可能是错误:
Or the issue might be completely different. sshpass might not be able to find some other dependency. "ssh" client might not be installed. Or your syntax might be wrong:
这篇关于无法在centOS中运行sshpass命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!