php, rsync and exec function

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

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

In my php script :

exec("/home/  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 )

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

eeolivierAuthor Commented:
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.
eeolivierAuthor Commented:
no, nothing there that can help me
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

add in /etc/sudoers:
wwwrun  ALL=(ALL) NOPASSWD: /home/

in php call exec('sudo /home/', $return);
Then your script will be run as root.

What do you want to do with that script exactly. Seems that you want to connect to an running ssh-agent. Are you sure that that agent still exists and under which user is thatagent running?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
eeolivierAuthor Commented:
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".
eeolivierAuthor Commented:
it was "visudo". I am going to try the tip
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.