본문 바로가기

OS&TOOL/리눅스

[우분투] 계정에 sudo 권한이 없는 경우 (visudo 사용 )

sudo vi chsh 수행 중 권한 오류 발생

 

sudo 명령어를 통해 root 권한을 취하려고 할 때 아래 오류 발생

oracle is not in the sudoers file.  This incident will be reported. 

 

 

oracle is not in the sudoers file.  This incident will be reported. 해결 방법

 

sudo 명령어를 실행할 수 있도록 /etc/sudoers 파일에 계정 추가 필요

다만 vi 편집기로 바로 수정은 안되며 (readonly 상태)

visudo -f /etc/sudoers 명령어를 이용해 수정해야 됨.

 

visudo -f /etc/sudoers

 

# User privilege specification의 root 밑에 아래 내용 추가 후 ctrl + X 를 입력

oracle  ALL=(ALL:ALL) ALL 

Y 입력

File Name to Write 이후 경로 부분 수정가능한 상태

/etc/sudoers.tmp 에서 .tmp 제거 후 엔터

Y 입력

Y 입력하면 기존 파일명으로 덮어쓰기 됨.

 

이후 해당 계정으로 이동하여 sudo 명령어를 실행하면 정상적으로 수행됨.