From owner-freebsd-questions@FreeBSD.ORG Thu Nov 24 07:24:27 2011 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 EEC39106564A for ; Thu, 24 Nov 2011 07:24:27 +0000 (UTC) (envelope-from kudzu@tenebras.com) Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id 8EA588FC16 for ; Thu, 24 Nov 2011 07:24:27 +0000 (UTC) Received: by wwg14 with SMTP id 14so3693818wwg.31 for ; Wed, 23 Nov 2011 23:24:26 -0800 (PST) MIME-Version: 1.0 Received: by 10.227.208.149 with SMTP id gc21mr17173588wbb.10.1322119466426; Wed, 23 Nov 2011 23:24:26 -0800 (PST) Received: by 10.180.81.193 with HTTP; Wed, 23 Nov 2011 23:24:26 -0800 (PST) In-Reply-To: <201111240501.pAO51jUb023756@x.it.okstate.edu> References: <201111240501.pAO51jUb023756@x.it.okstate.edu> Date: Wed, 23 Nov 2011 23:24:26 -0800 Message-ID: From: Michael Sierchio To: Martin McCormick Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: "freebsd-questions@freebsd.org" Subject: Re: Rsync and Preservation of Ownership and Permissions 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, 24 Nov 2011 07:24:28 -0000 On Wed, Nov 23, 2011 at 9:01 PM, Martin McCormick wrote: > =A0 =A0 =A0 =A0Rsync is a great utility, but is there a way to preserve > ownership and permissions if rsync remotely logs in to a backup > server as a normal user? Does the same user exist on the remote system, with the same uid, etc.? If you're using rsync with ssh as the transport, and connecting to the remote machine as the backups user, that's who will own the files on its local filesystem... You've written a lot of narrative, but show us precisely what commands you're running. Why would you run the command as root, and ssh as backups, when you want them to be owned by "normal" ? You can run the command as root, and use restricted ssh keys (use authorized_keys to restrict it to executing a specific rsync command).... you can run rsync as a regular user to that user's account on the remote system... > =A0 =A0 =A0 =A0The recovery process is run by root but copies all the > files from the backup server as a normal user and uses its root > capabilities to restore them. > > =A0 =A0 =A0 =A0What happens now is that all the files end up owned by > and in the group of the user ID that copied the information from > the client to the server. That's obviously not too useful so I > suspect there is a better way than trying to make a remote login > to root from another system. > > =A0 =A0 =A0 =A0Basically, cron starts a backup as root on system A. > System A makes a remote ssh connection using the -e flag to > backups@server. The system trying to recover the files starts a > rsync process as root which remotely connects to backups@server > to retrieve the files. > > =A0 =A0 =A0 =A0In practice, the files come across but every last one of > them is owned by and in the group of user backups. > > =A0 =A0 =A0 =A0Any ideas are greatly appreciated. > > Thank you. > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.o= rg" >