sre*_*ose 4 unix linux ssh shell sshpass
我试图从一台服务器到另一台服务器自动执行文件传输或FTP.
#!/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脚本时,我在putty中收到以下错误:
 -bash: sshpass: command not found
我尝试使用ssh无密码方法   ssh-keygen -t dsa和其他步骤,但我无法访问第二台服务器的putty,因为我无法执行下一步.
请帮助
Han*_*ani 22
您将需要在运行代码的客户端服务器上安装sshpass,这是一个默认情况下在大多数Linux发行版上都没有安装的工具
如果你在Ubuntu中使用此命令
apt-get install sshpass
在centOS/redhat上使用此安装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
谢谢
没有!!!!不要安装sshpass。这是您工作的错误工具。
它不是为您的用例编写的,如果您确实使用它,则脚本的安全性将大大降低。我应该知道我在说什么。我写的。
相反,请使用调试信息运行服务器,并弄清楚为什么无法设置基于密钥的身份验证。最好以sshpass各种可能的方式使用。
| 归档时间: | 
 | 
| 查看次数: | 45871 次 | 
| 最近记录: |