通过 PHP exec() 使用 SSH 无密码 ssh 登录进行 Rsync [英] Rsync via PHP exec() with SSH passwordless ssh login

查看:35
本文介绍了通过 PHP exec() 使用 SSH 无密码 ssh 登录进行 Rsync的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我通过 php exec() 运行命令:它不起作用.但是如果我使用 bash,它运行得很好.知道问题可能是什么.?我在想也许它正在以 apache 的身份执行 rsync 并且不允许 ssh 登录.

If I run the command via php exec(): It does not work. But if I use bash, it runs perfect. Any idea what the problem might be.? I was thinking maybe it is executing rsync as apache and not allowing ssh login.

exec('rsync -au /var/www/html/f1/ user@000.000.000.000:/var/www/html/f2/');

推荐答案

由于上述建议都不起作用,我不得不允许 Apache 用户帐户无密码访问我也需要上传图像的服务器.它就像我的魅力一样,在需要时,感谢所有试图帮助我解决问题的人.

Since none of the above suggestions would work, I had to allow the Apache user account passwordless access to the server I needed to upload images too. It works like I charm, just as needed, Thank you to all that attempted to help with my issue.

这篇关于通过 PHP exec() 使用 SSH 无密码 ssh 登录进行 Rsync的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆