From owner-freebsd-questions@FreeBSD.ORG Thu Jan 28 18:21:33 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 74F961065670 for ; Thu, 28 Jan 2010 18:21:33 +0000 (UTC) (envelope-from Viraj.Dixit@CityofPaloAlto.org) Received: from xmail.cityofpaloalto.org (cerberus.city.palo-alto.ca.us [199.33.32.254]) by mx1.freebsd.org (Postfix) with ESMTP id 5C87F8FC0A for ; Thu, 28 Jan 2010 18:21:33 +0000 (UTC) Received: from xpo.staff.copa ([172.17.1.12]) by xmail.cityofpaloalto.org with Microsoft SMTPSVC(6.0.3790.3959); Thu, 28 Jan 2010 10:21:32 -0800 x-mimeole: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Date: Thu, 28 Jan 2010 10:21:32 -0800 Message-ID: <9A8CAB63B4C2014B883AF16FDFB362FB01F016C7@xpo.staff.copa> In-Reply-To: <20100128090254.7452a557.freebsd@edvax.de> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Is their Automatic command to send a JPG file using FTP Thread-Index: Acqf8E21QsBiusPdRW25itShNsrFfgAVb2NA References: <9A8CAB63B4C2014B883AF16FDFB362FB01F016C5@xpo.staff.copa> <20100128090254.7452a557.freebsd@edvax.de> From: "Dixit, Viraj" To: "Polytropon" X-OriginalArrivalTime: 28 Jan 2010 18:21:32.0659 (UTC) FILETIME=[B7E0AC30:01CAA046] 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 List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jan 2010 18:21:33 -0000 Thanks so much. One question, I created a .netrc file and put it in the root (/root) directory and this is what it looks like below. I have taken out the IP, user name & password so no body can use them. Can you tell me if my syntax is correct and how do I activate this file and is this file in the right place on the server. Thanks, machine 172.16.0.38 login =20 password =20 macdef init binary lcd /ftp cd /var/temp get newemp.db quit VJ Viraj Dixit City of Palo Alto Information Technology 650-329-2118 -----Original Message----- From: Polytropon [mailto:freebsd@edvax.de]=20 Sent: Thursday, January 28, 2010 12:03 AM To: Dixit, Viraj Cc: freebsd-questions@freebsd.org Subject: Re: Is their Automatic command to send a JPG file using FTP 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=3Dmy_account_name_on_ftp_server FTPPASSWD=3Dmy_very_complicated_password SERVER=3Dftp.where_my_stuff_is.foo.bar UPLOAD=3D/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". --=20 Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...