Re: Shell script to call FTP [off-topic]

  • From: Guillermo Alan Bort <cicciuxdba@xxxxxxxxx>
  • To: painterman@xxxxxxxxx
  • Date: Tue, 5 Apr 2011 15:04:47 -0300

I don't think you can have the protocol specification as in web browsers:
ftp://blablabla, it should be  backup:bkp123@host, ftp will assume that
it's using FTP protocol (because it doesn't know any other) and the
ftp://is thus unnecessary.

So the script would look like this:
############
ftp backup:bkp123@xxxxxxxxx << _EOF_ >>/dev/null 2>&1
 bin
 prompt
 cd /srv43
 lcd /db/bugtracker/
 mput *.gz
 quit
_EOF_
############


hth
Alan.-


On Tue, Apr 5, 2011 at 2:55 PM, David Pintor <painterman@xxxxxxxxx> wrote:

> Hi Alex,
>
> I'm not very familiar with the old ftp syntax but I'd suggest you have a
> look at the manual (man ftp).
>
> However, I would strongly recommend you to generate a pair of
> authentication keys and to add your remote host public key to the
> authorized_hosts file (see here <http://www.linuxproblem.org/art_9.html>how 
> to do this, it's very straight forward) and then to use sftp instead of
> ftp, which is secure.
>
> The syntax then would be:
>
> *sftp username@host *
>
> And you wouldn't need to add your password to the script.
>
> Hope this helps.
>
> David
>
>
>
>
> On 5 April 2011 18:40, Alex List <alex@xxxxxxxxxxxxxx> wrote:
>
>> Hi,
>>
>> Sorry for posting an off-topic email, but I guess that my simple doubt is
>> really simple to you guys.
>>
>> In my shell script to transfer files, I am having difficult to do the way
>> I need.
>> Basically when I invoke the shell, it supposed to log in on FTP server
>> with password authenticated and so execute the ftp commands.
>>
>> ############
>> ftp ftp://backup:bkp123@xxxxxxxxx << _EOF_ >>/dev/null 2>&1
>>  bin
>>  prompt
>>  cd /srv43
>>  lcd /db/bugtracker/
>>  mput *.gz
>>  quit
>> _EOF_
>> ############
>>
>> However, when I try to execute I get error like: unknown host
>>
>> Do you have a suggestion what I am doing wrong??
>> This same script needs to run on Linux64/bash and AIX.
>>
>> Thank you in advance for any clue.
>> Alex
>>
>
>

Other related posts: