11
2
I'm getting the error mentioned in the title.
I found this similar question: Run rsync with root permission on remote machine. That doesn't answer my question.
I'm the admin on the remote server and I want to use rsync
to back up files to my local box. Here's my rsync command:
$ rsync -avz me@myserver.com:/var/www/ /backups/Sites/MySite/
It mostly works. Login is via a keypair. I don't and can't use a password (EDIT: to login via SSH). Just a few files won't transfer due to permissions. I don't want to change those permissions.
Here's the error:
receiving file list ... done
rsync: send_files failed to open "/var/www/webapp/securestuff/install.php": Permission denied (13)
I do not want to change the permissions on that file. It (and others like it) should not be readable (except by root).
This has to run in a cron job and I prefer a simple one-line solution using only the rsync command. The next choice would be a shell script I can call from the cron job. In no case can I manually log into the remote machine and become root (because I'll be sleeping when this runs.
How can I use rsync to back it up to my local box?
I got
rsync: send_files failed to open "/cygdrive/...": Permission denied (13)
. So my source computer was Windows cygwin. Slightly different situation, but for posterity, my solution was to right-click cmd.exe and Run as administrator. – Bob Stein – 2019-02-23T08:18:42.550can you please show us something like ssh me@myserver.com "cat /var/www/webapp/securestuff/install.php" >localfile ? – Florenz Kley – 2012-03-07T21:17:32.523
@Florenz Kley: I don't understand your comment – MountainX – 2012-03-07T21:43:39.883
show me that you can read the file and I show you a rsync command that works :-). Option #2 from grawity is probably your best bet. – Florenz Kley – 2012-03-07T22:07:30.900
@Florenz Kley: ssh me@myserver.com "echo mypassword | sudo -S cat /var/www/webapp/securestuff/install.php" > localfile – MountainX – 2012-03-08T03:37:32.737