CentOS 5
Sponsored Link

Add a User2015/01/13

[1] Add a new user like follows.
[root@dlp ~]#
useradd cent

[root@dlp ~]#
passwd cent

Changing password for user cent.
New UNIX password:
# input password you want to set

Retype new UNIX password:
# confirm

passwd: all authentication tokens updated successfully.
[root@dlp ~]#
[2] Try to switch to the user just added above.
dlp login:
cent
# input a user name

password:
# input the password

[cent@dlp ~]$
su -
# switch to the root user

Password:
# input the root password

[root@dlp ~]#
# just swithced

[3] Make a user be only the user who can switch to the root user.
[root@dlp ~]#
usermod -G wheel cent

[root@dlp ~]#
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.
# uncomment the line below

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

[4] Configure the email forwading settings. For example, if you'd like to forward emails for root account to another user, set like follows.
[root@dlp ~]#
vi /etc/aliases
# Person who should get root's mail
# uncomment and change to a user you'd like to set

root:
cent
[root@dlp ~]#
# apply new settings

Matched Content