简体   繁体   中英

How do I use rsync to backup the “/root” folder to a network share?

A share from my Iomega NAS Drive is mounted to a local directory on my home server running CentOS 6.4 as /mnt/backup-drive using AutoFS and CIFS.

When I run the following command:

rsync -ruvz --no-o --no-g --delete "/root" "/mnt/backup-drive"

I receive the following output:

...

rsync: recv_generator: mkdir "/mnt/backup-drive/root/.gnupg" failed: Permission denied (13) *** Skipping any contents from this failed directory ***

...

rsync: mkstemp "/mnt/backup-drive/root/..bash_profile.RBlhZj" failed: Permission denied (13)

...

etc etc and the folder "/mnt/backup-drive/root" remains completely empty. But when I use the same command to backup other directories, everything works great and smooth.

Hope that makes sense and help would be most welcome.

i assume you run the backup as a normal user and try to backup files that belong to the root user. this will not work because of permission problems.

run the rsync command as user root, or gain root privileges temporarily by prepending sudo in front of the command, eg

sudo rsync -ruvz --no-o --no-g --delete "/root" "/mnt/backup-drive"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM