2011-03-13 36 views

回答

0

將用戶添加到列表須藤,讓它不提示輸入密碼一定程序...編輯/ etc/sudoers文件這樣:

Cmnd_Alias BUNDLE = /usr/bin/bundle 

deploy ALL=(ALL) NOPASSWD:BUNDLE 

如果部署是用戶名,/usr/bin/bundle是我想要在沒有密碼的情況下訪問的程序的路徑。

+0

我會試試看。看看這個:http://shayanth.blogspot.com/2009/05/how-to-execute-sudo-shell-command-in.html。它建議使用'$ outPut = shell_exec(「echo password_for_the_user | sudo -S command_to_execute」);' - 也不適合我。任何想法爲什麼? – StackOverflowNewbie 2011-03-13 23:33:35

0

大概只有當用戶php運行爲(apache,沒有人或別的東西,取決於apache配置)才能工作,sudo啓用時沒有該命令的密碼。考慮到它打開的寬闊的打哈欠安全漏洞,這是不太可能的。