CentOSサーバーにおいてユーザー管理を行うための全般的な設定を行います。
各パッケージや運用で必要になる個別のグループおよびユーザー登録については、それぞれのコンテンツ内に記載しています。
※当コンテンツは 2014/11/23時点の CentOS7.0を対象としています。
メールアカウント作成管理
メールアカウントは Postfix + PoastfixAdmin + MariaDB/MySQLによる仮想アカウントで管理しますので、実ユーザー新規作成時にメールボックスが作成されないようにします。
/etc/default/useradd
@@ -5,5 +5,5 @@ EXPIRE= SHELL=/bin/bash SKEL=/etc/skel -CREATE_MAIL_SPOOL=yes +CREATE_MAIL_SPOOL=no
root権限で編集しています
ホームディレクトリ作成管理
-m オプションを付けずに実ユーザーの新規作成を行った場合、ユーザーのホームディレクトリを自動的に作成しないようにします。
/etc/login.defs
@@ -51,7 +51,7 @@ # On RH systems, we do. This option is overridden with the -m flag on # useradd command line. # -CREATE_HOME yes +CREATE_HOME no # The permission mask is initialized to this value. If not specified, # the permission mask will be initialized to 022.
root権限で編集しています
suコマンドの使用制限
su(ユーザー切替)コマンドの使用を rootユーザーと wheelグループユーザーのみに制限します。
/etc/pam.d/su
@@ -3,7 +3,7 @@ # Uncomment the following line to implicitly trust users in the "wheel" group. #auth sufficient pam_wheel.so trust use_uid # Uncomment the following line to require a user to be in the "wheel" group. -#auth required pam_wheel.so use_uid +auth required pam_wheel.so use_uid auth include system-auth account sufficient pam_succeed_if.so uid = 0 use_uid quiet account include system-auth
root権限で編集しています
suコマンドを使用させたいユーザーを wheelグループに追加します。
wheelグループに追加
# (例) # ユーザー user01 を新規作成時に wheelグループに追加します # 主グループを grp01 にしています [root]# useradd -g grp01 -G wheel usr01 # (例) # 作成済ユーザー user01 にwheelグループを追加します [root]# usermod -G wheel usr01
フィードバック
記事の内容についてのご質問、ご指摘、その他ご意見等は下記にてお願いいたします。- System House ACT公式ブログ内記事 :
- CentOS ユーザー管理
トラックバックまたはコメントにてお寄せください。