●メイングループapacheとして自分のアカウントを用意
[root@localhost ~]# useradd -g apache taro [root@localhost ~]# passwd taro Changing password for user taro. New UNIX password: Retype new UNIX password: passwd: all authentication tokens updated successfully.●ルート権限になれるユーザとする
[root@localhost ~]# usermod -G wheel taro [root@localhost ~]# id taro uid=500(toshi) gid=48(apache) 所属グループ=48(apache),10(wheel) context=user_u:system_r:unconfined_t●root になれるユーザを wheel グループのみに制限
[root@localhost ~]# mv /etc/pam.d/su /etc/pam.d/su.org [root@localhost ~]# cp /etc/pam.d/su.org /etc/pam.d/su [root@localhost ~]# vi /etc/pam.d/su [root@localhost ~]# diff /etc/pam.d/su.org /etc/pam.d/su 6c6 < #auth required pam_wheel.so use_uid --- > auth required pam_wheel.so use_uid●リモートから root ログイン無効。SSH接続ポートをデフォルトのままにしておくと四六時中狙われるので変更
[root@localhost ~]# cp /etc/ssh/sshd_config /etc/ssh/sshd_config.org [root@localhost ~]# diff /etc/ssh/sshd_config.org /etc/ssh/sshd_config 13a14 > Port 12345 39a41 > PermitRootLogin no●設定の適用
[root@localhost ~]# /etc/rc.d/init.d/sshd reload●あるいは再起動
[root@localhost ~]# /etc/rc.d/init.d/sshd restartDMZのサーバはここまですぐに実施(iptables か、業者が提供していればファイアーウォールを設定できれば理想)。 ●root宛てメール変更
[root@localhost ~]# mv /etc/aliases /etc/aliases.org [root@localhost ~]# cp /etc/aliases.org /etc/aliases [root@localhost ~]# vi /etc/aliases [root@localhost ~]# diff /etc/aliases.org /etc/aliases 96c96 < #root: marc --- > root: taro [root@localhost ~]# newaliases次回、外部へのメール送信環境ができたら taro を 手元の端末で受信する MyMail@outside.domain などに変更可能。