Sshpass: command not found error

I am trying to automate the transfer of files or FTP from one server to another.

#!/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 $?

When I execute this shell script, I get the following error in putty:

 -bash: sshpass: command not found

I tried using an ssh password without a method ssh-keygen -t dsaand other steps, but I can’t access the putty of the second server, because of which I can’t complete the following steps.

Request for help

0
source share
3 answers

you will need to install sshpass on the client server where your code is running, in which the tool is located, which by default is not installed on most Linux distributions

if you are using ubuntu use this command

apt-get install sshpass

on centOS / redhat use this install epel

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

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

sshpass

yum --enablerepo = epel -y install sshpass

+11

!!!! sshpass. .

, , script , . , . .

, . sshpass .

+2

sshpass bash script?

script sshpass ssh

export SSHPASS=password
sshpass -e ssh -oBatchMode=no user@host
0
source

All Articles