리눅스에서 su 명령어 사용을 특정사용자에게만...
두가지만 손봐주시면 됩니다 .
첫 번째, /etc/group 파일에서 wheel 그룹에 su 명령어를 사용할 사용자를 추
가합니다.
아래의 예는 필자가 운영하는 시스템의 경우의 예임.
[root@kebia_1 ]# cat /etc/group
root:x:0:root
bin:x:1:root,bin,daemon
daemon:x:2:root,bin,daemon
sys:x:3:root,bin,adm
adm:x:4:root,adm,daemon
tty:x:5:
disk:x:6:root
lp:x:7:daemon,lp
mem:x:8:
kmem:x:9:
wheel:x:10:root,sspark
두 번째, /etc/pam.d/su 파일에 아래의 빨간색으로 표시된 두줄을 설정해 주시
면 됩니다.
[root@kebia_1 ]# cat /etc/pam.d/su
#%PAM-1.0
auth sufficient /lib/security/pam_rootok.so
auth required /lib/security/pam_wheel.so debug group=wheel
# Uncomment the following line to implicitly trust users in the "wheel"
group.
#auth sufficient /lib/security/pam_wheel.so trust use_uid
# Uncomment the following line to require a user to be in the "wheel"
group.
#auth required /lib/security/pam_wheel.so use_uid
auth required /lib/security/pam_stack.so service=system-auth
account required /lib/security/pam_stack.so service=system-auth
password required /lib/security/pam_stack.so service=system-auth
session required /lib/security/pam_stack.so service=system-auth
session optional /lib/security/pam_xauth.so
세 번째로, su명령어의 사용을 허용한 사용자와 허용되지 않은 사용자가 각각
su명령어를 사용했을 때 /var/log/messages에 다음과 같은 로그기록의 차이점
이 있다.
먼저, picasso라는 su명령어사용이 허용되어 있지 않은 (정확히는 /etc/group
의 wheel그룹사용자가 아닌 경우)사용자가 su명령어를 사용했을 경우의 로그
는 다음과 같은 형식으로 남게된다.
Mar 14 16:34:13 kebia_1 sshd[1799]: Accepted password for picasso from
211.220.193.149 port 1035 ssh2
Mar 14 16:34:13 kebia_1 PAM_unix[1799]: (system-auth) session opened for
user picasso by (uid=0)
Mar 14 16:34:25 kebia_1 PAM-Wheel[1831]: Access denied for 'picasso'
to 'root'
다음은 su 명령어 사용이 허용된 sspark이라는 사용자가 su명령어를 사용했을
경우의 messages로그 기록예입니다.
Mar 14 16:34:49 kebia_1 sshd[1835]: Accepted password for sspark from
211.220.193.149 port 1036 ssh2
Mar 14 16:34:49 kebia_1 PAM_unix[1835]: (system-auth) session opened for
user sspark by (uid=0)
Mar 14 16:34:53 kebia_1 PAM-Wheel[1860]: Access granted to 'sspark'
for 'root'
Mar 14 16:34:56 kebia_1 PAM_unix[1860]: (system-auth) session opened for
user root by sspark(uid=500)
server
bibaram2005.02.18 · 4분 읽기 · 조회 4,392
리눅스에서 su 명령어 사용을 특정사용자에게만...
bibaram2005.02.18 · 4분 읽기 · 조회 4,392이어서 읽기
html↗
favicon.ico Status 404 해결방법
favicon.ico 파일이 있어서 경로를 직접 설정해주는 게 최선이지만favicon.ico가 없다면 아래와 같이 넣어준다. <html> <head> <link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon"> </head…
2020.09.25·1분 읽기
php↗
Codeigniter api에서 어떤 곳에서 보낸 json
$aData = var_export(file_get_contents('php://input'),TRUE); $aArr = json_decode(str_replace("'", "", $aData), true); 버전에 따라 다를 수도 있음 $this->input->raw_input_stream 이렇게 해보면 됨
2020.09.11·1분 읽기
server↗
apache 이미지 로그 안쌓이게 하기
웹서버를 운영하다 보면 Apache log 가 엄청나게 많이 쌓인다. logrotate 가 실행되고 있다면 어느 정도 로그가 정리가 되겠지만 아니라면 로그가 쌓여서 서버가 엄청 느려지거나 서버가 다운될 수도 있다. ErrorLo…
2020.02.17·2분 읽기
댓글 0
아직 댓글이 없습니다.