
일부 명령이 루트 권한에 의존하기 때문에 루트로 시작하거나 sudo를 통해 시작해야 하는 일부 타사 설치 프로그램 스크립트(ansible tower setup.sh)를 실행하려고 합니다. 그러나 일부스크립트 실행 중 명령은 sudo를 시도합니다.. 이유는 묻지 마세요. 설정 스크립트는 약간의 불일치가 있는 공동 작업인 것 같습니다.
따라서 스크립트가 실패하고 이를 재현할 수 있습니다. 루트로 sudo를 실행하려고 할 때마다 이 이상한 오류에 직면합니다. 예:
root@machine:/home/someuser: sudo echo 1
root is not allowed to run sudo on <FQDN here>. This incident will be reported.
나는 Ubuntu에 대한 이전 경험에서 그런 것을 본 적이 없습니다. (공정하게 말하면 현재 Google에서도 마찬가지입니다.)
모든 곳을 찾아서 sudo를 호출하지 않도록 스크립트를 변환하는 것은 옵션이 아니기 때문에 루트 사용자가 sudo를 수행할 수 있는 방법을 찾아야 합니다. 제가 작업 중인 Ubuntu 16.04 서버는 회사의 프라이빗 클라우드 공급자가 도메인 내부(중요 여부 IDK)에 의해 이국적인 방식으로 구성되었습니다.
내 /etc/sudoers는 다음과 같습니다:
#
# This file MUST be edited with the 'visudo' command as root.
# more bla bla
Defaults env_reset
Defaults mail_badpass
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"
# User privilege specification
root ALL=(ALL:ALL) ALL
# Members of the admin group may gain root privileges
+unixadmin,+unixadminext ALL= NOPASSWD: ALL
# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL
# See sudoers(5) for more information on "#include" directives:
#includedir /etc/sudoers.d
sudo에 대해:
root@machine:/home/someuser# which sudo
/usr/bin/sudo
root@machine:/home/someuser# ll /usr/bin/sudo
-rwsr-xr-x 1 root root 140816 Jun 7 2017 /usr/bin/sudo*
내가 무엇을 놓치고 있나요?
sudo 그룹에 루트 사용자를 추가했지만 문제가 해결되지 않았습니다.
답변1
루트로서 실행하십시오 groups
. 루트는 sudo 그룹에 없습니다. 왜 그래야 합니까?
문제를 해결하는 방법에 관해서는 sudo 그룹에 루트를 추가하거나 sudo를 실행하는 스크립트에 검사를 넣을 수 있습니다(특정 문제에 대한 가능성으로 무시했지만 다른 사람들에게는 해결책이 될 수 있습니다). .
sudo 그룹에 루트를 추가하려면:
(루트로)usermod -a -G sudo root