Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 4 Nov 2000 15:35:56 -0600 (CST)
From:      Ryan Thompson <ryan@sasknow.com>
To:        joe <joe@popidols.net>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: FTP (auto-fetch)
Message-ID:  <Pine.BSF.4.21.0011041522340.27749-100000@ren.sasknow.com>
In-Reply-To: <000801c04633$37fbd020$4b02000a@popidols.net>

next in thread | previous in thread | raw e-mail | index | archive | help

joe wrote to freebsd-questions@FreeBSD.ORG:

> Dear sir/Madam
> 
>     I've been trying to use the ftp (auto-fetch) command: 
>         ftp ftp://[user:password@]host[:port]/file[/]
>
> As I found, the default file transferring operation of this
> instruction is eqivalant to a ftp's "get" command, but actually I want
> this command to perform a ftp's "put" command and do it automatically.
> Therefor, are there any options or parameters I have to add to make it
> works?

Actually, ftp(1) doesn't support this sort of command line operation.  
Some time ago (FreeBSD 2.2.x, I think), I patched ftp(1) to support a put
if two arguments were given.  (Worked for single files).

Probably better is to write a .netrc in your home directory.

For example:

machine ftp.host.com
login yourname
password yourpassword
macdef init
put /path/to/local.file ./remote.file
quit

Then, from the command line

$ chmod 600 .netrc
$ ftp ftp.host.com

You MUST chmod 600 this file so that it is not readable by others
(otherwise, ftp(1) will complain that you have a world-readable password)

When you execute `ftp ftp.host.com`, ftp(1) will read .netrc, find your
login and password for ftp.host.com, and do the contents of the
"init" macro, which uses "put" to upload a file, then quits.

You could leave out the quit, and ftp(1) would be left in interactive
mode.


Hope this helps!

- Ryan

-- 
  Ryan Thompson <ryan@sasknow.com>
  Network Administrator, Accounts
  Phone: +1 (306) 664-1161

  SaskNow Technologies     http://www.sasknow.com
  #106-380 3120 8th St E   Saskatoon, SK  S7H 0W2



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0011041522340.27749-100000>