운영체제 깨알지식 웹핵






#리눅스 #CentOS #우분투 리눅스 #/etc/sudoers #usermod #sudo

[2020년 01월 21일]

리눅스 계정에 SUDO 권한 부여하기

요약

      sudo usermod -aG sudoer-group new-admin-user

본문

대부분의 리눅스 운영체제는 일반 사용자에게 최고사용자(superuser/root) 권한을 부여할 때 sudo 명령어를 사용하게 한다. 이 설정은 /etc/sudoers 파일에 저장되어 있으며 sudo 명령을 실행할 수 있는 그룹을 지정하고 있다. (마지막에서 라즈비안 리눅스의 예제 참조) 리눅스 배포판 마다 /etc/sudoers에 딸린 sudo 그룹의 이름이 다를 수 있다. 대개는 sudo이지만 CentOS의 경우에는 wheel이다.

CentOS 8 (Fedora, RedHat 등도 해당됨)

  • wheel 그룹에 계정을 추가하고 운영체제 재시작
[jinsuk@centos8 ~]$ sudo usermod -aG wheel newadmin
[sudo] jinsuk의 암호: *************
[jinsuk@centos8 ~]$ groups newadmin
newadmin : newadmin wheel
[jinsuk@centos8 ~]$ reboot

Unbuntu 19.x (Debian 계열)

  • sudo 그룹에 계정을 추가하고 운영체제 재시작
jinsuk@ubuntu19:~$ sudo usermod -aG sudo newadmin
ubuntu@ubuntu19:~$ reboot

Raspbian GNU/Linux 9.9

  • sudo 그룹에 계정을 추가하고 운영체제 재시작
pi@raspbian:~ $ sudo usermod -aG sudo newadmin
pi@raspbian:~ $ reboot

참고

다음은 참고로 라즈베리파이(Raspberry Pi)의 /etc/sudoers 파일을 보여주고 있다.

pi@raspbian:~ $ lsb_release -a
No LSB modules are available.
Distributor ID:	Raspbian
Description:	Raspbian GNU/Linux 9.9 (stretch)
Release:	9.9
Codename:	stretch
pi@raspbian:~ $ sudo cat /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"

# 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

pi@raspbian:~ $ 

[처음 작성한 날: 2020.01.21]    [마지막으로 고친 날: 2020.01.22] 


< 이전 글 : 맥OS에서 복수의 파일에 대한 일괄적인 파일 이름 변경 - Homebrew + rename (2020.01.23)

> 다음 글 : 센토스 8의 한국어 입력 설정 - ibus-hangul (2020.01.20)


크리에이티브 커먼즈 라이선스 이 저작물은 크리에이티브 커먼즈 저작자표시 4.0 국제 라이선스에 따라 이용할 수 있습니다.
잘못된 내용, 오탈자 및 기타 문의사항은 j1n5uk{at}daum.net으로 연락주시기 바랍니다.
웹핵.다이누.넷 대문 깨알지식 대문