我如何通过不带密码的php exec调用rsync?

问题描述 投票:0回答:1

我正在编写一个php脚本来通过exec这样运行rsync。

exec('sudo rsync -rtv -e "ssh -p port" source_folder username@ip:/destination_folder/');

它在ubuntu终端中有效,但是如果我运行php脚本则不能。我的猜测是,当我运行php脚本时,我无法键入密码。我希望php脚本在我调用它时就可以运行并完成工作。我该如何解决?

php exec rsync
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.