How to change admin password through CLI on Red Hat Satellite 6?
Environment
- Red Hat Satellite 6.x
Issue
-
How to change Satellite admin password through command line?
-
Below foreman-rake command can be used to reset the password but that create a random password, is there a way to set the password to specific one ?
# foreman-rake permissions:reset
Resolution
-
The
rakescript allows setting password as well, via:# foreman-rake permissions:reset password=NewPassword -
Note: If the username parameter is omitted, the command defaults to the admin user. This will either reset the password for the existing admin account or create the default admin user if it does not already exist.
-
To reset the password for a specific user, provide the username parameter explicitly:
# foreman-rake permissions:reset username=NewUserName password=NewPassword -
Optionally, one can use
hammerfor the same. First get the admin user ID from below command# hammer user list -
Then, change the password with below command:
# hammer user update --password <new-password> --id <admin-ID> -
Note:- If the same admin user credentials is used by hammer, then update the
~/.hammer/cli.modules.d/foreman.ymlfile as well.# vi ~/.hammer/cli.modules.d/foreman.yml << Enter/Update the latest credentials in file.
For more KB articles/solutions related to Red Hat Satellite 6.x Authentication Issues, please refer to the Red Hat Satellite Consolidated Troubleshooting Article for Red Hat Satellite 6.x Authentication Issues
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.