From owner-freebsd-questions Tue May 15 14:45:52 2001 Delivered-To: freebsd-questions@freebsd.org Received: from cache1.hck.carroll.com (cache1.hck.carroll.com [216.44.20.19]) by hub.freebsd.org (Postfix) with ESMTP id 4B16837B424 for ; Tue, 15 May 2001 14:45:47 -0700 (PDT) (envelope-from damien@carroll.com) Received: from 01.dhcp.hck.carroll.com ([10.64.0.224] verified) by cache1.hck.carroll.com (CommuniGate Pro SMTP 3.2.4) with ESMTP id 2954541; Tue, 15 May 2001 17:45:36 -0400 Date: Tue, 15 May 2001 17:45:36 -0400 From: Damien Tougas To: Tony Wells Cc: Daniel Frazier , freebsd-questions@FreeBSD.ORG Subject: Re: Scripting FTP actions Message-ID: <199050000.989963136@01.dhcp.hck.carroll.com> In-Reply-To: <3B019740.2110063D@magpage.com> X-Mailer: Mulberry/2.0.8 (Linux/x86) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG --On Tuesday, May 15, 2001 16:53:20 -0400 Daniel Frazier wrote: > Tony Wells wrote: >> >> Hi all, >> I need to be able to set up something where I can script a bunch of >> FTP actions to send files to a remote server and I'm not sure where to >> start looking. >> >> As far as a client I use ncftp, and looking at the man page I only see >> "auto fetching" of files. >> >> Has anyone done this, or am I better off just writing a perl script >> that pretends to be an FTP client? >> > > I'd use scp. with scp you can utilize a ~/.ssh/authorized_keys file > on the destination machine and you won't have to put any passwords in > the script. Another way you can do this is by setting up macros for the FTP client. I am not very familiar with ncftp, but I do know you can do this with the FreeBSD ftp client. If you put a macro in your .netrc file called init for a particular host, it will be automatically processed as soon as you try to connect to a that host. An example .netrc file is as follows: machine ftp.someplace.com login dude password abc123 macdef init passive lcd /home/dude/textfiles cd /upload/dude mput *.txt quit When I type "ftp ftp.someplace.com" at the command line or put it in a script, the init macro will automatically be processed, uploading all *.txt files from the /home/dude/textfiles directory to /upload/dude on the remote server, then logoff. Check out the ftp man page for more details. --- Damien Tougas Systems Administrator Carroll-Net, Inc. http://www.carroll.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message