[英]Mount remote file system using sshfs with a PHP script
我希望我的 PHP 腳本可以使用 sshfs 命令安裝遠程系統。 但這似乎不起作用,文件夾已創建,但執行后文件夾仍為空。 我還嘗試了一個沒有 SU 的用戶,它工作正常。
mkdir ("/var/mont/remote/");
$cmd = "sshfs -o password_stdin -o allow_other enzo@192.168.0.29:/home/enzo/remote/ /var/mont/remote/ <<< 'MyRemotePassword'";
$output = nl2br(shell_exec($cmd));
echo $output;
該腳本(test.php)應該可以工作:
#!/usr/bin/env bash
php -r 'mkdir ("/var/mont/remote");
$cmd = "sshfs -o password_stdin -o allow_other enzo@192.168.0.29:/home/enzo/remote/ /var/mont/remote/ <<< 'MyRemotePassword'";
$output = nl2br(shell_exec($cmd));
echo $output;'
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.