您的位置:首页 > 运维架构 > Shell

curl和shell脚本进行ftp的上传下载

2010-03-25 11:33 387 查看
ftpput.sh

#!/bin/sh
curl -T $1 -u name:passwd ftp://192.168.1.2/[/code] 
ftpget.sh

#!/bin/sh
curl -O -u name:passwd ftp://192.168.1.2/$1[/code] 


#!/bin/sh
wget -c ftp://name:passwd@192.168.1.2/$1[/code] 
shell脚本进行ftp的上传下载

#!/bin/sh
if [ $# -lt 2 ] ;then
echo "$0 put|get file"
exit 0
fi
file=$2
command_file='.ftp.script.tmp'
echo "open 192.168.1.2 21" > $command_file
echo "user name passwd" >> $command_file
echo "binary" >> $command_file
if [ $1 == 'put' ] ; then
echo "put $file" >> $command_file
elif [ $1 == 'get' ] ; then
echo "get $file" >> $command_file
fi
echo "bye"      >> $command_file
ftp -i -in <  $command_file
rm -rf $command_file


但是用的电脑用这个shell脚本登陆,一直有下面的错误,网上查了下说是KERBEROS_V4的权限认证,没搞清楚怎么弄

Please login with USER and PASS.

Please login with USER and PASS.

KERBEROS_V4 rejected as an authentication type

Failed to open file.

后来改用curl的脚本登陆才行,或者手动ftp命令登陆也能行。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: