LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-08-2008, 08:44 AM   #1
hypercondor
LQ Newbie
 
Registered: May 2008
Distribution: Slackware
Posts: 8

Rep: Reputation: 0
FTP auto upload problem.


Ok so i got my script to connect to the ftp but for some reason the file wont upload.
Code:
#!/bin/sh
/sbin/ifconfig | grep "inet addr" | cut -f2 -d: | cut -f1 -d' ' | sed 1q >> ip1.txt 
ftp setzer
mput /home/ip1.txt
quit
any help would be great.
 
Old 05-08-2008, 09:04 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
Hmmm... it is not the right way to do. You have to pass a bunch of commands to the ftp session. To do this you can enclose them in a "here document". Furthermore, provided the remote server is "setzer", you must give username and password to login (unless you've setup autologin by editing the file ~/.netrc). For example
Code:
ftp -ni setzer << EOS
user username password
lcd /home
put ip1.txt
quit
EOS
The -n option prevents autologin, the -i option turns off interactive prompting during multiple transfers (if any). Also you cannot specify a full path in the put command: you have to change to a local directory (see the lcd command) before doing transfer. Hope this helps.
 
Old 05-08-2008, 09:20 AM   #3
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,819
Blog Entries: 1

Rep: Reputation: 1200Reputation: 1200Reputation: 1200Reputation: 1200Reputation: 1200Reputation: 1200Reputation: 1200Reputation: 1200Reputation: 1200
I had a similar problem with lftp.
http://www.linuxquestions.org/questi...lftp+sycamorex
 
Old 05-09-2008, 12:12 AM   #4
hypercondor
LQ Newbie
 
Registered: May 2008
Distribution: Slackware
Posts: 8

Original Poster
Rep: Reputation: 0
Talking

Quote:
Originally Posted by colucix View Post
Hmmm... it is not the right way to do. You have to pass a bunch of commands to the ftp session. To do this you can enclose them in a "here document". Furthermore, provided the remote server is "setzer", you must give username and password to login (unless you've setup autologin by editing the file ~/.netrc). For example
Code:
ftp -ni setzer << EOS
user username password
lcd /home
put ip1.txt
quit
EOS
The -n option prevents autologin, the -i option turns off interactive prompting during multiple transfers (if any). Also you cannot specify a full path in the put command: you have to change to a local directory (see the lcd command) before doing transfer. Hope this helps.
Thanks alot, and yes i had set up the /.netrc makes things a whole bunch easier.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ftp upload script problem. please help pinkygoyal Programming 8 02-15-2008 04:20 PM
vsftpd non-annoy ftp cannot upload, mkdir problem sleepyhomme Linux - Server 2 04-29-2007 12:39 PM
FTP upload hinetvenkat Linux - Software 3 06-02-2005 10:34 PM
FTP upload problem: Error 550 Access Denied andrewstr Linux - Networking 0 12-17-2003 02:19 PM
ftp upload hotrodowner Linux - Networking 20 10-11-2002 05:23 PM


All times are GMT -5. The time now is 08:05 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration