/etc/nginx/sites-enabled/php에 파일을 만들고 싶습니다. 여러 번 시도했지만 PHP가 이미/etc/sudoers를 수정했다고 생각하지 않습니다. 나는 그들에게 사용자 ALL을 넣는다 : NOPASSWD : ALL 그리고 여전히 작동하지 않는 누군가는 왜 나에게 말할 수 있는가?/etc에 디렉토리를 만들고 PHP로
$result= shell_exec('sudo -u root mkdir /etc/nginx/myfile');
내 파일은/etc /의 sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults env_reset
Defaults exempt_group=sudo
Defaults mail_badpass
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
# Host alias specification
# User alias specification
# Cmnd alias specification
Cmnd_Alias NGINXVHOST = /bin/ln, /bin/mkdir
# User privilege specification
# root ALL=(ALL:ALL) ALL
root ALL= (ALL) NOPASSWD:ALL
# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL
# Allow members of group sudo to execute any command
%sudo ALL=(ALL) NOPASSWD:ALL
vagrant ALL=(ALL) NOPASSWD:ALL
subdominio ALL=(ALL) NOPASSWD:ALL
# See sudoers(5) for more information on "#include" directives:
#includedir /etc/sudoers.d
도와주세요!
웹에 액세스 할 수있는 PHP 액세스 권한을 루트에 부여하는 것은 미친 짓입니다. – ceejayoz
만약 그렇다면 사실 내 문제는 PHP 가상 호스트를 만들고 싶다는 것입니다. –
와일드 카드 DNS와 같은 * .example.com과 논리로 요청 된 호스트를 결정할 수 있습니다. – user2182349