cat /etc/sudoers로 sudoers 파일 확인
이 단계에서는 sudo의 주요 설정 파일인 /etc/sudoers 파일을 검사합니다. 이 파일은 어떤 사용자 또는 그룹이 어떤 명령을 어떤 사용자로 실행할 수 있는지 결정합니다.
중요: /etc/sudoers 파일을 직접 편집하는 것은 위험할 수 있으며, 잘못된 경우 시스템에 접근할 수 없게 될 수 있습니다. 구문 검사를 제공하므로 일반적으로 이 파일을 편집하려면 visudo 명령을 사용하는 것이 좋습니다. 그러나 이 단계에서는 구조를 이해하기 위해 cat 명령을 사용하여 파일의 내용을 간단히 볼 것입니다.
/etc/sudoers는 시스템 파일이므로 읽으려면 sudo 권한이 필요합니다.
터미널에 다음 명령을 입력하고 Enter 키를 누릅니다.
sudo cat /etc/sudoers
/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 mail_badpass
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"
## Host alias specification
## User alias specification
## Cmnd alias specification
## User privilege specification
root ALL=(ALL:ALL) 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 ALL=(ALL:ALL) ALL 줄은 특히 중요합니다. 이는 sudo 그룹 (%sudo) 의 구성원인 모든 사용자가 모든 호스트 (ALL) 에서 모든 사용자 (ALL) 및 모든 그룹 (ALL) 으로 명령을 실행할 수 있음을 의미합니다. 이는 Ubuntu 와 같은 Debian 기반 시스템에서 사용자에게 관리 권한을 부여하는 일반적인 방법입니다.
이 파일을 봄으로써 시스템에서 sudo 권한이 어떻게 구성되는지 알 수 있습니다.
다음 단계로 이동하려면 계속을 클릭하십시오.