steve's Add admin/sudo user account for WHM

Supports: CentOS 6.5 with cPanel (pre-installed)/7 with cPanel (pre-installed) (64-bit)

Source Code

#!/bin/bash

# <env name="new_admin_username" label="New Admin User Account" example="Create this user name" />
# <env name="new_admin_user_password" label="New Admin User's Password" example="user's password" />


function add_new_admin_user {

  local USERNAME=$NEW_ADMIN_USERNAME
  local USERPASS=$NEW_ADMIN_USER_PASSWORD

  useradd $USERNAME
  echo "$USERNAME:$USERPASS" | chpasswd
  echo "$USERNAME:all" >> /var/cpanel/resellers
  usermod -aG admin $USERNAME
  usermod -aG $USERNAME $USERNAME
  echo "$USERNAME ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
}

add_new_admin_user

Preload Preload Preload