> On Tue, Jan 01, 2002 at 08:39:39AM -0500, Keith Elder wrote: > > This brings up a question. How do you rsync something but keep the > > ownership and permissions the same. I am pulling data off site nightly > > and that works, but the permissions are all screwed up. > > rsync -avxrP --delete $FILESYSTEMS backup-server:backups/$HOSTNAME > > Some caveats if you want to fully automate this... > - remove -vP (verbose w/ progress) > - --delete is NECESSARY to make sure deleted files get deleted from the > backup > - FILESYSTEMS should be any local filesystems you want backed up (-x > won't cross filesystems, makes backing up in NFS environment easier) > - obviously this doesn't preclude a bad guy checking out > backup-server:backups/otherhostname (use ssh keys, and invoke cmd="cd > backups/hostname; rsync with whatever daemon options" will limit that) Hello Ted, Now I know how to use "command=" in ~/.ssh/authorized_keys2. Providing I have backupserver and debianclient. In ~/.ssh/authorized_keys2 of backupserver "command=" section, what command should I put to automate the backup procedure between backupserver and debianclient? I tried: command="cd /backup; /usr/bin/rsync -av debianclient:/dirtobackup ./"
But when I ssh from debianclient to backupserver, it gives me a password prompt,, so I enter the password, then rsync begins. I don't understand what "command=" means. Does it only specify what will the server do upon ssh login? Can it specify some commands and parameters to restrict ssh <host> <pre-specified command> ? > - on backup-server, rotate the backup every 12 hours or whatever. > - rsync -ar --delete store/hostname.2 store/hostname.3 > - rsync -ar --delete store/hostname.1 store/hostname.2 > - rsync -ar --delete backups/hostname store/hostname.1 > # that could be better optimized, but you get the idea > > I've used this rsync system to successfully maintain up to date backups w/ > great ease, AND restore very quickly... use a LinuxCare Bootable Business > Card to get the target fdisked and ready, then mount the filesystems as > you desire, and rsync -avrP backup-server:backups/hostname /target. I got > a 700mb server back online in under 20 minutes from powerup to server > serving requests (the rsync itself is 3 to 5 minutes). Making sure you > do (cd /target; lilo -r . -C etc/lilo.conf)) is the only tricky part. > > -- > Ted Deppner > http://www.psyber.com/~ted/ > > > -- > To UNSUBSCRIBE, email to [EMAIL PROTECTED] > with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED] -- Patrick Hsieh <[EMAIL PROTECTED]> GPG public key http://pahud.net/pubkeys/pahudatpahud.gpg