Question
How do I change an email account password via CLI on a cPanel/WHM server?
Answer
This can be done using a uapi call with the proper parameters.
Note: In the following examples, $user is the cPanel user, $email is the full email address with the domain, and $pass is the new password, if applicable.
- Connect to your server using SSH as the
rootuser. -
Make the
uapiEmail/passwd_popcall, providing the required parameters:# uapi --user=$user Email passwd_pop email='$email' password='$pass'
CPANEL_WARN: Setting the user's password directly in the command line is not always desired, as it leaves an entry in the server's history.
You can use the following example to set a random password instead:
# uapi --user=$user Email passwd_pop email='$email' password=$(openssl rand -base64 12)
Comments
0 comments
Article is closed for comments.