centOS 无法运行 sshpass 命令 [英] Unable to run sshpass command in centOS

查看:82
本文介绍了centOS 无法运行 sshpass 命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 CentOS release 6.3 (Final) 系统上工作.并尝试使用 sshpass 实用程序(如

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

但它给了我类似的错误

sshpass: Failed to run command: No such file or directory

所以从错误我认为 sshpass 可能没有安装所以尝试通过 yum install sshpass 安装它并获取以下日志

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?

推荐答案

检查你的shell是否知道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环境变量的路径,让你的shell可以定位到:

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆