Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

automatically uploading a file through FTP 1

Status
Not open for further replies.

nroberts420

Programmer
Jun 24, 2003
27
US
Is there anyway to upload a file onto an FTP server where you don't have to phisically be at the terminal to type in the username and password? I want a script to upload a page on to a web server through FTP so I can have access to the info in the file but I don't want to have to be there to enter my username and password. Is there a way to have the script automaically email the file or the contents of the file to me? Which would be easier?
 
The manual page for ftp (under linux at least, YMMV), talks about a .netrc file.

This file can contain username and password information.

But be sure to remove all group/world permissions before you try and use it for ftp, since it holds a clear-text password.
 
Here's how to script an ftp:

ftp -n <IP address of where you want to ftp> << EOF
user <username> <password>
ascii (or binary)
cd <directory where you want to put>
put <filename>
bye

If you want another ftp within the same script, rather than using bye, type EOF and then start the stanza over again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top