CentOS 5
管理用一般ユーザー作成
[1] 管理用の一般ユーザーを作成します。
[root@ns ~]#
useradd cent

[root@ns ~]#
passwd cent

Changing password for user cent.
New UNIX password:
# 設定したいパスワードを入力

Retype new UNIX password:
# パスワード再入力

passwd: all authentication tokens updated successfully.
[root@ns ~]#
[2] 以降は、まず、一般ユーザーでログインし、必要があるときのみ、rootユーザーにスイッチして作業するようにします。 rootユーザーは何でもできるため、誤操作により重要なファイルを消してしまうのを避けるためです。
ns login:
cent
# ログインユーザー名を入力

password:
# パスワード入力

[cent@ns ~]$
su -
# rootユーザーに遷移

Password:
# rootパスワード入力

[root@ns ~]#
# rootユーザーに遷移完了

[3] rootになれるユーザーを[1]で追加したcentのみにします。
[root@ns ~]#
vi /etc/group


# 11行目:追加したいユーザー名を追記

wheel:x:10:root
,cent


[root@ns ~]#
vi /etc/pam.d/su


#%PAM-1.0
auth sufficient pam_rootok.so
# 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 include system-auth
account sufficient pam_succeed_if.so uid = 0 use_uid quiet
account include system-auth
password include system-auth
session include system-auth
session optional pam_xauth.so
root宛メール転送
[4] root宛に送られてくるメールを管理用に作成した一般ユーザーに転送します。
[root@ns ~]#
vi /etc/aliases


# Person who should get root's mail
# 最終行頭の#を削除し転送するユーザー名に変更

root:
cent


[root@ns ~]#
# 設定の変更を反映

/etc/aliases: 77 aliases, longest 10 bytes, 776 bytes total