From owner-freebsd-questions@FreeBSD.ORG Mon Jan 10 06:37:44 2005 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D7BC616A4CE for ; Mon, 10 Jan 2005 06:37:44 +0000 (GMT) Received: from mtiwmhc12.worldnet.att.net (mtiwmhc12.worldnet.att.net [204.127.131.116]) by mx1.FreeBSD.org (Postfix) with ESMTP id 35C3A43D55 for ; Mon, 10 Jan 2005 06:37:43 +0000 (GMT) (envelope-from jayobrien@worldnet.att.net) Received: from [192.168.1.6] (dsl093-180-184.sac1.dsl.speakeasy.net[66.93.180.184]) by worldnet.att.net (mtiwmhc12) with ESMTP id <20050110063742112008kqp3e> (Authid: jayobrien@att.net); Mon, 10 Jan 2005 06:37:42 +0000 Message-ID: <41E222B5.5060002@att.net> Date: Sun, 09 Jan 2005 22:37:41 -0800 From: Jay O'Brien User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.2) Gecko/20040803 X-Accept-Language: en-us, en MIME-Version: 1.0 To: FreeBSD - questions References: <41E1E95C.5040803@att.net> <1105328080.41e1f7d09cdcd@mail.chubbo.net> In-Reply-To: <1105328080.41e1f7d09cdcd@mail.chubbo.net> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: ssh file transfers - how to? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Jan 2005 06:37:45 -0000 joseph kacmarcik wrote: >>For purposes of discussion, I'm logged into the distant machine >>as jay@distantmachine.net. I'm logged in to the directory /www/jay >>and my localmachine directory (now empty) is /home/www/jay. I want >>everything in the www/jay directory on distantmachine to be copied >>as the home/www/jay directory on localmachine. > > > this depends whether you want a backup or if you want to have a live copy, there > are a few ways (more on that later). > > for a backup, you could (test first please): > ssh remotehost "tar cf - /www/jay" > /path/to/tarfile Thanks, this will come later - It's now on my to do list. > or for live copy, two methods would be: > ssh remotehost "tar cf - /www/jay" | tar -C /home/www/jay -xf - > scp -pr remotehost:/www/jay /home/www/jay > > Interesting, I ran it with only the -r argument and saw the file date/times were current; I read the MAN page and found the -p argument, and found it worked as promised. Thanks for confirming! >>My follow-on question is -- Is there a way to synchronize the local >>machine with the distant machine if changes are made on the distant >>machine, and vice-versa, on a generic basis, i.e. "distantmachine >>is now the master, correct localmachine to agree"? > > > if you're trying to get a working copy and not backup, use rsync. this would be > much easier, and it's easy to make it bi-directional (or more). > > there are many ways to do this, one is: > rsync -azvprt -e ssh [user]@remotehost:/www/jay /home/www > The rsync program sounds like what I will need once I get things working. I'm building a duplicate of my web site, here on my local computer, and ultimately it will be a working copy at a slightly different URL. > you could use -n and --progress when you're doing the debugging getting it right > for your situation and environment. > > you'll still be transporting over ssh, but IMO rsync is a better choice. > > good luck! > joe Joe, thanks. I can't go wrong with the support team here on questions. This is fun! Jay