Link to home
Start Free TrialLog in
Avatar of eeolivier
eeolivier

asked on

php, rsync and exec function

I need from a PHP script running ."script.sh"  that contain  :

SSH_AUTH_SOCK=/tmp/ssh-XXlFi8Jl/agent.3825; export SSH_AUTH_SOCK;
SSH_AGENT_PID=3826; export SSH_AGENT_PID;
echo Agent pid 3826;
/usr/bin/rsync --delete -ave ssh /data/AUDIO_FILES/ srv01:/data/AUDIO_FILES/

In my php script :

exec("/home/script.sh  2>&1",$return);

print_r($return) give me :

Array ( [0] => Agent pid 3826 [1] => Could not create directory '/.ssh'. [2] => Host key verification failed. [3] => unexpected EOF in read_timeout )

PLEASE HELP !!
Avatar of eeolivier
eeolivier

ASKER

Maybe you could tell me how to execute a script with root rights, and with all PATH ok ? maybe it's the problem ?
See http:Q_21108456.html how to setup sudo to work with the webserver user, so you can run that script as root.
no, nothing there that can help me
ASKER CERTIFIED SOLUTION
Avatar of hernst42
hernst42
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
yes, that script run perfectly when I run it from the shell as root.

It let me to synchronize files over 5 different servers avec over SSH without having to type password.

When i do vi /etc/sudoers, under root user, i have "read only file".
it was "visudo". I am going to try the tip