sshpass:找不到命令错误 [英] sshpass: command not found error

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

问题描述

我正在尝试自动将文件或FTP从一台服务器传输到另一台服务器.

I am trying to automate the file transfer or FTP from one server to the other.

#!/bin/bash
### In this model, the same filename is processed on each run.
### A timestamp is added to the result file and data file is copied to the archive or error folder with a timestamp after processing.

# Set current directory
cd `dirname "$0"`

# Set the environment variables
. ./Environment.sh $0

#######################################################################################################
# 
#######################################################################################################


FILE=/hcm/Inbound/file.csv

sshpass -p 'xyz' sftp -oBatchMode=no -b - -oStrictHostKeyChecking=no zys@192.abc.taleo.net <<_EOF_

cd /upload/

put $FILE

_EOF_

# Exit
exit $?

执行此shell脚本时,在腻子中出现以下错误:

When I am executing this shell script I am getting the following error in putty :

 -bash: sshpass: command not found

我尝试通过ssh-keygen -t dsa和其他步骤使用ssh无密码方法,但由于无法执行后续步骤,因此无法访问第二台服务器的腻子.

I tried using the ssh passwordless method by ssh-keygen -t dsa and other steps but I cannot access putty of the second server due to which I am not being able to execute the next steps.

请帮助

推荐答案

您将需要在正在运行代码的客户端服务器上安装sshpass,该工具在大多数Linux发行版中均未默认安装

you will need to install sshpass on the client server you are running your code in which is a tool that is not installed by default on most Linux distro

如果您在Ubuntu中,请使用此命令

if you are in Ubuntu use this command

apt-get install sshpass

apt-get install sshpass

在centOS/redhat上使用此 安装epel

on centOS/redhat use this install epel

wget http://download.fedoraproject.org /pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

rpm -ivh epel-release-6-8.noarch.rpm

rpm -ivh epel-release-6-8.noarch.rpm

安装sshpass

yum --enablerepo = epel -y安装sshpass

yum --enablerepo=epel -y install sshpass

谢谢

这篇关于sshpass:找不到命令错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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