954,525 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

FTP Automation difficulty

I'm running on a Linux machine and can't get FTP uploads working. Here's my script:
HOST='ftp.name.com'
USER='username'
PASSWD='mypwd'
FILE='f1020811'
DIR='/data_dir/send'
echo **************************************************************
echo * Attempting FTP *
echo **************************************************************
ftp -n -u -d ftp.name.com <

musicalsailor
Newbie Poster
5 posts since Aug 2010
Reputation Points: 10
Solved Threads: 0
 

Is there a reason to use ftp specifically?

Linux has scp (Secure Copy) which like ssh uses encrypted traffic to move files between servers. The following web site has a great explanation of using scp and tells you how to set up the servers with rsa keys so that no password is needed for a specific user on each system to be able to transfer files and even gives sample shell scripts.

http://www.linuxjournal.com/article/8600

rch1231
Posting Shark
959 posts since Sep 2009
Reputation Points: 119
Solved Threads: 142
 

This doesn't look like a solution since I have to copy from our Linux box to an IBM iSeries. But thanks for the thought.
John

musicalsailor
Newbie Poster
5 posts since Aug 2010
Reputation Points: 10
Solved Threads: 0
 

Ok well in that case try this instead.

#!/bin/sh
HOST='ftp.users.qwest.net'
USER='yourid'
PASSWD='yourpw'
FILE='file.txt'

ftp -n $HOST <<END_SCRIPT
quote USER $USER
quote PASS $PASSWD
put $FILE
quit
END_SCRIPT
exit 0
rch1231
Posting Shark
959 posts since Sep 2009
Reputation Points: 119
Solved Threads: 142
 

Thanks. I found this to work:
#!/bin/sh
USER=username
PASSWD=PSWD
ftp -n -v -d ftp.placecom <

musicalsailor
Newbie Poster
5 posts since Aug 2010
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You