LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-03-2007, 07:57 AM   #1
indiancosmonaut
Member
 
Registered: Feb 2007
Posts: 65

Rep: Reputation: 15
How do you ftp files to a particular server!


Hi

I wish to know how do u ftp files to a server , non-interactively.

Thanks in advance.

Kind Regards,
indiancosmonaut
 
Old 04-03-2007, 08:05 AM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
If I understand the question correctly, you would put the commands in a script.
Could you give more detail about what you are trying to do?
 
Old 04-03-2007, 08:47 AM   #3
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Read the man page for ftp. There is a section on auto-fetching files.

You can also use the form:

ftp ftp://user:password@host/path/ <ftpscript

This way you can execute several commands from a script. Add the "bye" command as the last command in the script.

You can also use wget or curl to retrieve files from an ftp site as well as from web sites.

Last edited by jschiwal; 04-03-2007 at 08:49 AM.
 
Old 04-09-2007, 03:03 AM   #4
indiancosmonaut
Member
 
Registered: Feb 2007
Posts: 65

Original Poster
Rep: Reputation: 15
Hi guys,

Sorry for replying so late.

The scenario is:

I am logged-on system-A and i want to put some file on system-B without prompting user to enter password. Absolutely Non-Interactivery.

The USER, PASSWORD and SERVER will be exported in the environment.

The shell is : ksh

Can u kindly tel me what are the pre-requisites and how to go about it in a step by step procedure.

I tried...
ftp ftp://$FTP_User:$FTP_Password:$FTP_Server/home/indiancosmonaut/

where FTP_User, FTP_Password, FTP_Server are environment variables and /home/indiancosmonaut/ is the directory on system-B where i wish to put the file.

But its showing error:
unknown host or invalid literal address

Please help

Kind Regards,
indiancosmonaut
 
Old 04-09-2007, 09:28 AM   #5
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
Quote:
Originally Posted by indiancosmonaut
Hi guys,

Sorry for replying so late.

The scenario is:

I am logged-on system-A and i want to put some file on system-B without prompting user to enter password. Absolutely Non-Interactivery.

The USER, PASSWORD and SERVER will be exported in the environment.

The shell is : ksh

Can u kindly tel me what are the pre-requisites and how to go about it in a step by step procedure.

I tried...
ftp ftp://$FTP_User:$FTP_Password:$FTP_Server/home/indiancosmonaut/

where FTP_User, FTP_Password, FTP_Server are environment variables and /home/indiancosmonaut/ is the directory on system-B where i wish to put the file.

But its showing error:
unknown host or invalid literal address

Please help

Kind Regards,
indiancosmonaut
If using the URL style.. it would look something like:

ftp://<username>:<password>@hostname/path/to/directory

Your getting the error cause it thinks "$FTP_User:$FTP_Password:$FTP_Server" is the hostname since you have a colon after the password and not the @.

Last edited by trickykid; 04-09-2007 at 09:29 AM.
 
Old 04-10-2007, 01:05 AM   #6
indiancosmonaut
Member
 
Registered: Feb 2007
Posts: 65

Original Poster
Rep: Reputation: 15
Hi trickykid,
thanks!

I tried...

ftp ftp://ftpuser:ftppassword@host/home/indiancosmonaut


but again its giving the same error.

Can u kindly give me some real example of the syntax.

Also, since i need to put a request-file on system-B and after sometime i need to retrieve a reply-file from system-B. Can u suggest me some script to do this.

Thanks in advance,

Kind Regards,
indiancosmonaut!

Last edited by indiancosmonaut; 04-10-2007 at 01:07 AM.
 
Old 04-12-2007, 02:44 AM   #7
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Quote:
Originally Posted by indiancosmonaut
I wonder if ftp server doesn't like you including the path in the ftp command.
Try
ftp://ftpuser:ftppassword@host
and then have a
cd home/indiancosmonaut
in your ftp script.

Sometimes, expect is used to provide the username and password. This general solution shouldn't be necessary in this case.

Look at the output of:
echo ftp ftp://$FTP_User:$FTP_Password:$FTP_Server/home/indiancosmonaut/
Does it print what you expect?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How do you ftp files to a particular server! indiancosmonaut Linux - Newbie 2 04-03-2007 02:42 PM
LXer: Backup MySQL databases, web server files to a FTP server automatically LXer Syndicated Linux News 0 08-11-2006 09:54 PM
how to put files on the ftp server bry21 Linux - Networking 5 01-25-2006 12:11 AM
ftp server - Pure ftp - logs in OK but no files visible tp11235 Linux - Networking 2 08-30-2005 05:11 AM
how can I restrict ftp users listing files from a pure-ftp server adrianmak Linux - Networking 2 12-31-2002 08:23 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:16 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration