1.下载
https://sourceforge.net/projects/sshpass/files/
or
https://pan.baidu.com/s/1pLNxeLd
or
wget http://sourceforge.net/projects/sshpass/files/latest/download -O sshpass.tar.gz
1.安装
tar -zxvf sshpass-1.06.tar.gz
cd sshpass-1.06
./configure
make
make install
3.编写脚本
#!/bin/bash
password=123456
user=root
ip=10.0.0.37
file=/home/file.txt
sshpass -p $password scp file $user@$ip:/home/copy/