본문 바로가기
FullStack/40. Linux

사용자에게 SUDO 권한 부여

by nakanara 2021. 8. 12.
반응형

사용자에게 SUDO 권한 부여

root 계정으로 접속하여
/etc/sudoers 파일 수정 권한 부여
sudoers 파일은 읽기 권한만 부여된 상태이므로 쓰기 권한을 부여한 후 작업 진행 후 회수한다.

-r--r-----. 1 root root 4328  9월 30  2020 sudoers

$ chmod +w /etc/sudoers

-rw-r-----. 1 root root 4328  9월 30  2020 sudoers
$ vi /etc/sudoers

sudo 권한을 부여할 사용자를 입력 후, 필요 커맨드를 작성 후 저장

## Next comes the main part: which users can run what software on
## which machines (the sudoers file can be shared between multiple
## systems).
## Syntax:
##
##      user    MACHINE=COMMANDS
##
## The COMMANDS section may have other options added to it.
##
## Allow root to run any commands anywhere
root    ALL=(ALL)       ALL
user    ALL=(ALL)       ALL

쓰기 권한 회수

chmod -w /etc/sudoers
-r--r-----. 1 root root 4356  8월 12 10:34 sudoers
반응형