learnNewThingAlways
learnNewThingAlways

Reputation: 51

rsync: mkstemp failed: Permission denied (13)

I am writing one shell script which have below command to copy the code files from remote server to local server by skipping some file but it gives errors like :

Command :

rsync -avz --delete --exclude=**/cache --exclude=**/administrator/cache/ --exclude=**/tmp --exclude=**/configuration.php -e ssh $REMOTE_USER@$REMOTE_SERVER:$REMOTE_PATH $LOCAL_PATH

Errors :

1) rsync: mkstemp "/var/www/test.domainname/public/.sript.php.4FRyfv" failed: Permission denied (13)

2) rsync: mkstemp "/var/www/test.domainname/public/.access.txt.PECuqA" failed: Permission denied (13)

3) rsync: failed to set times on "/var/www/test.domainname/public/administrator/components/com_bconnect": Operation not permitted (1) administrator/components/com_bconnect/

4) rsync: mkstemp "/var/www/test.domainname/public/administrator/components/com_bconnect/.config.xml.8LWLWF" failed: Permission denied (13)

Can you please help me out for above 4 errors.

Upvotes: 1

Views: 13225

Answers (2)

yogender
yogender

Reputation: 586

This is basically a permission issue for the remote/local directory to/from which one invites the data. I solved this error in a slightly differenr form again! I was sending files from the local ubuntu machine to the remote ubuntu machine through this.

rsync -arvz -e 'ssh -p 64060' ./SE-D-20-00279R2.pdf yogender@<IP>:</path/to/destination>

I had the same permission error:

rsync: mkstemp "<path/of/the/file2/you/try/to/rsync>" failed: Permission denied (13)
....
....
....
rsync: mkstemp "<path/of/the/file2/you/try/to/rsync>" failed: Permission denied (13)

After fiddling around I find this solution:

  1. Problem: the receiver doesn't know the permission with the sender solution: Need to create the folder at the receiver side (big machine) with sudo.

    sudo mkdir </path/to/directory/you/are/sending/file/to/remote/machine>
    
  2. Give the permission to the folder, which will send the data to this directory:

    sudo chown yogender </path/to/directory/you/are/sending/file/to/remote/machine>
    

yogender here is the admin or user. you can get it by doing "whoami" on remote machine (when you are sending data from local to remote)

  1. Then simply:

    rsync -zaP -e 'ssh -p 64060' ./SE-D-20-00279R2.pdf [email protected]:</path/to/directory/you/are/sending/file/to/remote/machine>>
    

Upvotes: 1

Dougie Nisbet
Dougie Nisbet

Reputation: 21

I've just come across this error in a different form, i.e. attempting to rsync to a nested directory in /var/www/html on a remote server and not having write permission to the /var/www/html directory itself. In my case my error turned out to be due to mangled rsync syntax, but in your case you probably don't have permission to write to /var/www. This is where rsync is attempting to create its temporary files.

From my understanding you have two options:

use the --temp-dir parameter

use the --inplace parameter.

This is explained in the rsync man page and has also been asked before.

Upvotes: 2

Related Questions