2010년 5월 12일 수요일

SU 명령 제한한

일반사용자들이 수퍼유저계정으로 변경을 하려면su라는 명령어를 쓰게된다.



만약 su명령을 몇몇 사람들에게만 쓸수 있게 하려한다면 다음과 같이하면 된다.

]# vi /etc/pam.d/su

#%PAM-1.0

auth sufficient /lib/security/pam_rootok.so

# 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

위 설정은 wheel 그룹에 속한 사용자들만이 su 명령을

쓸수 있다는 것을 말한다.

wheel은 이러한 목적으로 사용될 수 있는 특별한 계정이다. 따라서 wheel 이외의 그룹은 위와같이 사용될 수없다.

위 설정에서 wheel 그룹에 속한 사람만이 su 명령을 사용할 수있게 했으므로 su 명령을 써야하는 계정이 있다면 wheel 그룹에 추가시켜 주어야한다. 만약 in4mania 라는 계정을 wheel 그룹으로 추가하려면 다음과 같이한다.

다음 명령에서 G는 그룹을 나타내며, 10은 wheel 에 해당하는 값이다.

]# usermod -G10 in4mania

댓글 없음:

댓글 쓰기