0

I am running rsync --archive, which includes the -p parameter that takes over the file's permissions. The sync is from a distant computer to the local machine. This works in a SSH shell.

But if I call the same command from within PHP, it throws error messages:

var_dump(shell_exec("/usr/bin/rsync -v --archive --rsh='/usr/bin/ssh <sshparameters>' remotecomputer /local/path/ 2>&1"));

rsync: [generator] failed to set permissions on "/local/path/subdir/single-file": Permission denied (13)

PHP runs with the same user as SSH. PHP can chmod the very same file that is copied properly but has the wrong permissions:

var_dump(shell_exec("chmod -v 777 /local/path/subdir/single-file 2>&1"));

What is going on here? Is there any environment variable that might cause the errors in rsync?

netAction
  • 101

0 Answers0