su 명령어 특정 사용자만 허용
PAM에서는 특정 사용자만 특정한 그룹(wheel)에 속하도록 하여 그 그룹에 속한 사용자만 특정한 권한을 가지도록 하기 위해 pam_wheel.so라는 모듈을 제공합니다. 또한 리눅스에서는 기본적으로 wheel이라는 그룹이 생성되어 있으므로 이 두가지를 사용하면 됩니다.
1. wheel 그룹 확인
[root@localhost ~]# cat /etc/group | grep wheel
wheel:x:10:
2. wheel 그룹에 사용자 추가
[root@localhost ~]# vi /etc/group
wheel:x:10:root,latch
3. /etc/pam.d/su 수정
[root@localhost ~]# vi /etc/pam.d/su
#%PAM-1.0
auth sufficient pam_rootok.so
# Uncomment the following line to implicitly trust users in the "wheel" group.
#auth sufficient pam_wheel.so trust use_uid
# Uncomment the following line to require a user to be in the "wheel" group.
auth required pam_wheelso use_uid ← 주석 해제
auth substack system-auth
auth include postlogin
account sufficient pam_succeed_if.so uid = 0 use_uid quiet
account include system-auth
password include system-auth
session include system-auth
session include postlogin
session optional pam_xauth.so
4. 허용되지 않은 계정에서 su 시도
[latch2@localhost root]$ su -
암호:
su: 권한 부여 거부
'Server > CentOS' 카테고리의 다른 글
[CentOS] is not in the sudoers file (0) | 2021.01.11 |
---|---|
[CentOS] 로그인 실패시 계정 잠금 (0) | 2021.01.07 |
[CentOS] 패스워드 정책 설정 (0) | 2020.12.29 |
[CentOS] 방화벽 설정 (0) | 2020.12.29 |
[CentOS] 로그 관리 (0) | 2020.12.29 |