Create a System Administrator User on CentOS Server
How to create a system administrator user on a CentOS server
Requirements
A CentOS server installed, if you didn't installed it yet have a look to the CentOS 6.x Server Installation tutorial.
Create a System Administrator user
Login as
root
user and create an administrator user:centos-srv login: root Password: ... # useradd administrator # passwd administrator Changing password for user administrator. New password: Retype new password: passwd: all authentication tokens updated successfully. #
Logout and login as
administrator
user, then try to switch toroot
usingsu
command:centos-srv login: administrator password: $ su - Password: #
Make
administrator
user as the only a user who can switch toroot
by adding it to thewheel
group and editing PAM service configuration:# usermod -G wheel administrator # Add administrator to wheel group # vi /etc/pam.d/su ... # Uncomment the following line to require a user to be in the "wheel" group. auth required pam_wheel.so use_uid ...
Add
administrator
to the sudoers file:# visudo ... # Add the following last lines # System Administrator can use all root privilege administrator ALL=(ALL) ALL
Forward emails for
root
toadministrator
user by editing the/etc/aliases
file, then runnewaliases
command:# vi /etc/aliases ... # Person who should get root's mail root: administrator ... # newaliases #
Danilo