Using rsync to backup remote server as root
allistar.m at gmail.com
Wed Aug 26 22:18:03 MDT 2009
I use this rsync command to backup "/" of a remote server:
rsync -Hav --delete --exclude-from=backup.excludes --delete-excluded -e "ssh -p
45658" root at samwise:/ /mnt/backup/samwise/backup
samwise: is the name of the server (yes yes, I know, naming computer after
Hobbits may be considered bad form)
45685 is the port samwise is listening on for ssh.
I need the user to be root so they can see all files on the remote server.
The problem is that to do this I have to turn on the "PermitRootLogin"
setting in the sshd configuration on the remote server as well as
add "root" to the "AllowUsers" setting. For security reasons I don't want
to have to do that.
How do I enable a full backup of the remote server without allowing root top
log in to ssh? Can I somehow get rsync to login as a normal user and then
do some kind of "sudo" command?
More information about the rsync