I wanted to backup an aws machine and exclude os files, only user files including root owned ones which need sudo permission to read.
Asked
Active
Viewed 78 times
-1
-
What do you mean by "files with sudo permission"? Also, how is this problem related to programming? – Nico Haase Jun 01 '23 at 08:50
-
@NicoHaase Just updated my question to be clear. – Jahan Zinedine Jun 01 '23 at 12:33
1 Answers
0
rsync -aAXv --rsync-path="sudo rsync" -e ssh \
--exclude={"/swapfile","/var/lib/*","/var/cache/*","/usr/*","/sbin/*","/lib/*","/home/admin/go/*","/home/admin/downloads/*","/home/admin/.sdkman/*","/home/admin/.oh-my-zsh/*","home/admin/.rbenv/*","home/admin/.nvm/*","/home/admin/.npm/*","/home/admin/.m2/*","/home/admin/.gvm/*","/home/admin/.cache/*","/dev/*","/boot/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} \
admin@ec2-3-122-251-181.eu-central-1.compute.amazonaws.com:/ \
~/aws_machine
-e ssh: specifies that the rsync command should use the ssh protocol for the transfer.
--rsync-path="sudo rsync" fixes the permission denied for non-user owned files and folders

Jahan Zinedine
- 14,616
- 5
- 46
- 70