ひとり勉強ログ

ITエンジニアの勉強したことメモ

Apacheの設定vo.2~実行ユーザーを「www」ユーザーに変更~

Apacheを起動しているユーザーの確認

[bash]

ps aux | grep http

www 10894 0.0 0.0 112664 964 pts/0 R+ 21:52 0:00 grep --color=auto http [/bash]

設定ファイルのあるディレクトリへ移動

[bash]

cd /etc/httpd/conf/

[/bash]

httpd.conf」ファイルのバックアップ

[bash]

cp -p httpd.conf httpd.conf20170120

[/bash]

httpd.conf」ファイルを開いて編集

[bash]

vi httpd.conf

[/bash]

下記部分を編集 [bash] #

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 apache Group apache [/bash] [編集前] [bash] User apache Group apache [/bash] [編集後] [bash] User www Group www [/bash]

Apacheを再起動

[bash]

systemctl restart httpd.service

[/bash]

Apacheを起動しているユーザを再度確認

[bash]

ps aux | grep http

root 11368 0.0 0.3 307760 11864 ? Ss 22:30 0:00 /usr/sbin/httpd -DFOREGROUND www 11369 0.0 0.1 309844 6356 ? S 22:30 0:00 /usr/sbin/httpd -DFOREGROUND www 11370 0.0 0.1 309844 6356 ? S 22:30 0:00 /usr/sbin/httpd -DFOREGROUND www 11371 0.0 0.1 309844 6356 ? S 22:30 0:00 /usr/sbin/httpd -DFOREGROUND www 11372 0.0 0.1 309844 6356 ? S 22:30 0:00 /usr/sbin/httpd -DFOREGROUND www 11373 0.0 0.1 309844 6356 ? S 22:30 0:00 /usr/sbin/httpd -DFOREGROUND root 11392 0.0 0.0 112664 968 pts/0 R+ 22:31 0:00 grep --color=auto http [/bash]