Here I am going to give admin privilege to a normal user and going to set him as the only user who can switch to root account. For that we need to add the normal user to the wheel group. Wheel is a special administrative group in centos. Now we are going to add the user to the group wheel and for that I am going to use the command usermod. You can find more information about usermod from its man page by typing
[root@server105 ~]# man usermod
I will add the user joji to wheel group
and will give admin privilege to him
[root@server105 ~]# usermod -G wheel
joji
Now we need to edit the file
/etc/pam.d/su to set the user as the only user who can switch to
root account
[root@server105 ~]# vi /etc/pam.d/su
Now as mentioned in the file Uncomment
the following line to require a user to be in the "wheel"
group.
#auth required
pam_wheel.so use_uid
Now I have Uncommented it
Now I am going to try to switch to root
from the user clado
[clado@server105 ~]$ su - root
Password:
su: incorrect password
As you can see I am unable to switch to
the root user.
Now am going to try to switch to root
from the user joji
[joji@server105 ~]$ su - root
Password:
[root@server105 ~]#
As you can see I am able to switch to
the root user successfully.
That's all folks Enjoy
No comments:
Post a Comment