Unable to run sshpass command in centOS [closed]

社会主义新天地 提交于 2019-12-02 01:18:04

问题


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

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

from above it seems sshpass is already installed.So why it not working?


回答1:


Check if your shell knows the locations of sshpass

which sshpass

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

Or add the path to the PATH environmental variable, so that your shell can locate it:

export PATH=$PATH:/path/to/

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:



来源:https://stackoverflow.com/questions/21375125/unable-to-run-sshpass-command-in-centos

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!