现在的位置: 首页 > 综合 > 正文

SCP不需要输入密码的sh脚本

2013年09月06日 ⁄ 综合 ⁄ 共 326字 ⁄ 字号 评论关闭

#!/bin/sh
ReleaseServer=192.168.2.100
ftp_user=root
ftp_password=123456
auto_scp()
{
expect -c "
spawn rsync -tv $2 ${@:3};
sleep 1
expect {
        *yes/no*      {send yes\n; exp_continue}
        *?úá?*      {send $1\n}
        *word*        {send $1\n}
        }
sleep 1
expect eof
"
return $?
}
cd /users
auto_scp $ftp_password $ftp_user@$ReleaseServer:/132.pcap .
exit

抱歉!评论已关闭.