From owner-freebsd-questions@FreeBSD.ORG Mon Jan 10 03:34:48 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 0F7ED16A4CE for ; Mon, 10 Jan 2005 03:34:48 +0000 (GMT) Received: from rooster.chubbo.net (rooster.chubbo.net [168.75.98.30]) by mx1.FreeBSD.org (Postfix) with ESMTP id D8F1B43D53 for ; Mon, 10 Jan 2005 03:34:45 +0000 (GMT) (envelope-from freebsd-questions@chubbo.net) Received: from rooster.chubbo.net (localhost [127.0.0.1]) by rooster.chubbo.net (8.12.9/8.12.3) with ESMTP id j0A3YeR5044460; Sun, 9 Jan 2005 19:34:41 -0800 (PST) (envelope-from freebsd-questions@chubbo.net) Received: (from nobody@localhost) by rooster.chubbo.net (8.12.9/8.12.9/Submit) id j0A3YeDA044459; Sun, 9 Jan 2005 19:34:40 -0800 (PST) (envelope-from freebsd-questions@chubbo.net) X-Authentication-Warning: rooster.chubbo.net: nobody set sender to freebsd-questions@chubbo.net using -f Received: from c-67-169-93-71.client.comcast.net (c-67-169-93-71.client.comcast.net [67.169.93.71]) by mail.chubbo.net (IMP) with HTTP for ; Sun, 9 Jan 2005 19:34:40 -0800 Message-ID: <1105328080.41e1f7d09cdcd@mail.chubbo.net> Date: Sun, 9 Jan 2005 19:34:40 -0800 From: joseph kacmarcik To: "Jay O'Brien" References: <41E1E95C.5040803@att.net> In-Reply-To: <41E1E95C.5040803@att.net> MIME-Version: 1.0 Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 7bit User-Agent: cc: questions@freebsd.org 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 03:34:48 -0000 > 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 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 > 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 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