이것은 나의 /etc/sudoers
visudo로 편집 한 파일이지만 sudo를 할 때 암호를 입력하라는 메시지가 계속 표시됩니다.
root ALL=(ALL) ALL
%admin ALL=(ALL) NOPASSWD:ALL
petruza ALL=(ALL) ALL
petruza ALL=(ALL) NOPASSWD:ALL
## Uncomment to allow members of group wheel to execute any command
%wheel ALL=(ALL) ALL
## Same thing without a password
%wheel ALL=(ALL) NOPASSWD: ALL
이전 OS 설치에서 실행 중이었지만 지금은 작동하지 않습니다.
내 주된 필요는 자동으로 실행하는 것입니다. xampp
시작할 때 암호를 물어 보지 않아도됩니다.
답변
xampp을 시작 데몬으로 시작하면 sudoers 파일을 수정하지 않아도됩니다 :
-
파일 만들기 org.xampp.startup.plist in / Library / LaunchDaemons with :
sudo touch/nano ...
및 다음 내용 :<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>org.xampp.startup</string> <key>ProgramArguments</key> <array> <string>/bin/bash</string> <string>/Applications/XAMPP/xamppfiles/xampp</string> <string>start</string> </array> <key>RunAtLoad</key> <true/> <key>StandardErrorPath</key> <string>/tmp/org.xampp.startup.stderr</string> <key>StandardOutPath</key> <string>/tmp/org.xampp.startup.stdout</string> </dict> </plist>
XAMPP를 다른 곳에 설치 한 경우 수정하십시오
<string>/Applications/XAMPP/xamppfiles/xampp</string>
따라서. -
chown / chmod 파일 :
sudo chown root:wheel /Library/LaunchDaemons/org.xampp.startup.plist sudo chmod 644 /Library/LaunchDaemons/org.xampp.startup.plist
-
다음과 같이 데몬을로드하십시오.
sudo launchctl load /Library/LaunchDaemons/org.xampp.startup.plist
-
모든 것이 잘 실행되면 plist의 다음 부분을 제거 할 수 있습니다.
<key>StandardErrorPath</key> <string>/tmp/org.xampp.startup.stderr</string> <key>StandardOutPath</key> <string>/tmp/org.xampp.startup.stdout</string>
-
visudo로 기본 sudoers 파일을 복원하십시오.
... root ALL=(ALL) ALL %admin ALL=(ALL) ALL ## Uncomment to allow members of group wheel to execute any command #%wheel ALL=(ALL) ALL ## Same thing without a password #%wheel ALL=(ALL) NOPASSWD: ALL ...