Create a new user with admin/sudo privileges as an alternative to using the root account over SSH and in WHM
Deploy this script (requires existing VPS)
The settings below are requested when deploying the script:
New Admin User Account: |
Create this user name |
---|---|
New Admin User's Password: |
user's password |
#!/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