From owner-freebsd-questions@FreeBSD.ORG Thu Jan 28 08:02:57 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2C6C0106566C for ; Thu, 28 Jan 2010 08:02:57 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mx02.qsc.de (mx02.qsc.de [213.148.130.14]) by mx1.freebsd.org (Postfix) with ESMTP id DFFEE8FC12 for ; Thu, 28 Jan 2010 08:02:56 +0000 (UTC) Received: from r55.edvax.de (port-92-195-188-34.dynamic.qsc.de [92.195.188.34]) by mx02.qsc.de (Postfix) with ESMTP id 2A5731D8FF; Thu, 28 Jan 2010 09:02:54 +0100 (CET) Received: from r55.edvax.de (localhost [127.0.0.1]) by r55.edvax.de (8.14.2/8.14.2) with SMTP id o0S82sQS002167; Thu, 28 Jan 2010 09:02:54 +0100 (CET) (envelope-from freebsd@edvax.de) Date: Thu, 28 Jan 2010 09:02:54 +0100 From: Polytropon To: "Dixit, Viraj" Message-Id: <20100128090254.7452a557.freebsd@edvax.de> In-Reply-To: <9A8CAB63B4C2014B883AF16FDFB362FB01F016C5@xpo.staff.copa> References: <9A8CAB63B4C2014B883AF16FDFB362FB01F016C5@xpo.staff.copa> Organization: EDVAX X-Mailer: Sylpheed 2.4.7 (GTK+ 2.12.1; i386-portbld-freebsd7.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: freebsd-questions@freebsd.org Subject: Re: Is their Automatic command to send a JPG file using FTP X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Polytropon List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jan 2010 08:02:57 -0000 On Wed, 27 Jan 2010 14:08:40 -0800, "Dixit, Viraj" wrote: > Hi, > I am looking to see if there a command or a script In BSD Os that will > allow me to ftp to a server automatically and get a file from another > server. User name and passwd will be already in the script so it will > run ftp and download a file or a JPG from that server. Like in Linux OS > there is a command using .netrc file and you can script that file and > will automatically do what is in the file at time interval that you > want. Thanks, In FreeBSD, there's documentation on that; read "man ftp" and see the -u option. I'm often (ab)using a Makefile to upload (send) files per FTP to a server, and I call this "make install". You can put this into a shell script (sh) and then call it, e. g. #!/bin/sh FTPUSER=my_account_name_on_ftp_server FTPPASSWD=my_very_complicated_password SERVER=ftp.where_my_stuff_is.foo.bar UPLOAD=/path/to/files/to/upload cd ${UPLOAD} && ftp -u ftp://${FTPUSER}:${FTPPASSWD}@${SERVER} * Of course, you can utilize .netrc to contain FTP access data. Then, you just need to call "pure" ftp with server name, and you can replace * with any file name(s) you want. However, be aware that FTP doesn't encrypt passwords. You should take into mind that using FTP with an SSH wrapper, or even better - scp - is a more secure way to "send files". -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...