From owner-freebsd-questions@FreeBSD.ORG Thu Nov 24 14:05:34 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 A6406106566C for ; Thu, 24 Nov 2011 14:05:34 +0000 (UTC) (envelope-from martin@dc.cis.okstate.edu) Received: from x.it.okstate.edu (x.it.okstate.edu [139.78.2.13]) by mx1.freebsd.org (Postfix) with ESMTP id 7B4428FC0A for ; Thu, 24 Nov 2011 14:05:34 +0000 (UTC) Received: from dc.cis.okstate.edu (localhost [127.0.0.1]) by x.it.okstate.edu (8.14.4/8.14.4) with ESMTP id pAOE5Xw9026028 for ; Thu, 24 Nov 2011 08:05:33 -0600 (CST) (envelope-from martin@dc.cis.okstate.edu) Message-Id: <201111241405.pAOE5Xw9026028@x.it.okstate.edu> To: "freebsd-questions@freebsd.org" Date: Thu, 24 Nov 2011 08:05:33 -0600 From: Martin McCormick 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 14:05:34 -0000 Michael Sierchio writes: > Does the same user exist on the remote system, with the same uid, etc.? Yes. > 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... I thought rsync had some encoding it might slip in to the tree that another rsync run as root on the recovering system could use to figure out all those thousands of ownerships and get them all straight, but this makes perfect sense. > 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" ? Because root is the only user who can "see" files from all other users so root starts the process. Here is what I tried. Remember, folks, this will not work! This tries to backup a system named z. ##!/bin/sh #rsync --delete -alHvq --exclude "/proc" // backups@backup-server.okstate.edu:z > 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... perryh@pluto.rain.com writes: > Perhaps you could have rsync log in to a jail on the backup server, > where it could safely be granted root permission. Hmm. It's all rather clear, now. A jailed environment that looks like root is about the only thing that could work. Thank you.