Create a System Administrator User on CentOS Server

How to create a system administrator user on a CentOS server

This tutorial explain how to create a system administrator user after installing a CentOS 6.3 server.


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

  1. Login as root user and create an administrator user:

    centos-srv login: root
    # useradd administrator
    # passwd administrator
    Changing password for user administrator.
    New password:
    Retype new password:
    passwd: all authentication tokens updated successfully.
  2. Logout and login as administrator user, then try to switch to root using su command:

    centos-srv login: administrator
    $ su -
  3. Make administrator user as the only a user who can switch to root by adding it to the wheel 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 use_uid
  4. Add administrator to the sudoers file:

    # visudo
    # Add the following last lines
    # System Administrator can use all root privilege
    administrator    ALL=(ALL)       ALL
  5. Forward emails for root to administrator user by editing the /etc/aliases file, then run newaliases command:

    # vi /etc/aliases
    # Person who should get root's mail
    root:           administrator
    # newaliases