리눅스 아파치 프로세스 소유자 변경하기

리눅스 아파치 실행 소유자 변경하기

다음의 명령어로 아파치 프로세스를 확인하면 프로세스 소유자가  daemon으로 되어있다.

$ ps -ef | grep httpd
root 5310 1 0 Aug31 ? 00:00:08 /usr/local/httpd-2.4.10/bin/httpd -k start
daemon 11178 5310 0 22:52 ? 00:00:00 /usr/local/httpd-2.4.10/bin/httpd -k start
daemon 11179 5310 0 22:52 ? 00:00:00 /usr/local/httpd-2.4.10/bin/httpd -k start
daemon 11180 5310 0 22:52 ? 00:00:00 /usr/local/httpd-2.4.10/bin/httpd -k start
nextman 12165 10310 0 23:02 pts/2 00:00:00 grep httpd
$ su -
Password:

다음과 같이 httpd.conf파일을 열어 User와 Group을 nextman으로 변경하고 아파치를 재실행 한다.

# vi /usr/local/httpd/conf/httpd.conf
IfModule unixd_module
#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User nextman
Group nextman

/IfModule

# apachectl restart

다시 아파치 프로세스를 확인하면 아파치 프로세스 소유자가 nextman으로 변경되었음을 확인할 수 있다.

# ps -ef | grep httpd
root 5310 1 0 Aug31 ? 00:00:09 /usr/local/httpd-2.4.10/bin/httpd -k start
nextman 12287 5310 0 23:03 ? 00:00:00 /usr/local/httpd-2.4.10/bin/httpd -k start
nextman 12288 5310 2 23:03 ? 00:00:00 /usr/local/httpd-2.4.10/bin/httpd -k start
nextman 12289 5310 0 23:03 ? 00:00:00 /usr/local/httpd-2.4.10/bin/httpd -k start
nextman 12427 5310 0 23:03 ? 00:00:00 /usr/local/httpd-2.4.10/bin/httpd -k start
root 12460 12183 0 23:03 pts/2 00:00:00 grep httpd

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다