1
비밀번호 프롬프트없이 sudo ls -l
명령을 실행하고 싶습니다.암호 프롬프트가 표시되지 않음
$streams = array(
0 => array("pipe", "r"), // stdin
1 => array("pipe", "w"), // stdout
2 => array("pipe", "w") // stderr
);
$process = proc_open('sudo ls -l', $streams, $pipes);
if (is_resource($process)) {
list($stdin, $stdout) = $pipes;
fwrite($stdin, "password\n"); //must write password, but not
fclose($stdin);
var_dump(stream_get_contents($stdout));
fclose($stdout);
$returnCode = proc_close($process);
echo "Return code $returnCode\n";
}
실행 암호 프롬프트가 여전히 존재하면이를 피하는 방법은 무엇입니까?
가능한 중복 http://stackoverflow.com/questions/3166123/how-to-call-shell-script-from-php-that-requires-sudo –
불행하게도 아니, sudo는 단지 예이며, I 암호가 필요한 도구에 연결해야합니다. – cetver