Create a System Administrator User on CentOS Server
Published 2012-11-07
How to create a system administrator user on a CentOS serverRequirements
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
rootuser 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
administratoruser, then try to switch torootusingsucommand:centos-srv login: administrator password: $ su - Password: #Make
administratoruser as the only a user who can switch torootby adding it to thewheelgroup 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
administratorto the sudoers file:# visudo ... # Add the following last lines # System Administrator can use all root privilege administrator ALL=(ALL) ALLForward emails for
roottoadministratoruser by editing the/etc/aliasesfile, then runnewaliasescommand:# vi /etc/aliases ... # Person who should get root's mail root: administrator ... # newaliases #
Danilo