centos 에서 sudoers 설정


관리자로 로그인 후 추가할 아이디가 hahaha 인 경우

$vi /etc/sudoers

## Allow root to run any commands anywhere
root           ALL=(ALL)       ALL
hahaha         ALL=(ALL)       ALL          <= 추가

 


## Same thing without a password <=== 비밀번호 물어보지 않게
#%wheel  ALL=(ALL)       NOPASSWD: ALL 

주석제거


저장후 빠져나옴.


그리고 
wheel 그룹에 hahaha 사용자 추가

$vi /etc/group
중간쯤~~
wheel:x:10:root,hahaha        <== 사용자추가

저장.


hahaha 사용자로 로그인 후 
sudo tail /etc/sudoers 하면

$ sudo tail /etc/sudoers
[sudo] password for devtainer:
# %wheel        ALL=(ALL)       NOPASSWD: ALL

## Allows members of the users group to mount and unmount the
## cdrom as root
# %users  ALL=/sbin/mount /mnt/cdrom, /sbin/umount /mnt/cdrom

## Allows members of the users group to shutdown this system
# %users  localhost=/sbin/shutdown -h now
hahaha       ALL=(ALL)       ALL

이렇게 나오면 정상

sudo: /etc/sudoers is mode 0640, should be 0440 
sudo: no valid sudoers sources found, quitting
 
 
이렇게 나오면 퍼미션 에러
chmod u-w /etc/sudoers
퍼미션을 440으로 변경해준다.  
Posted by [czar]
,