Creating the htpasswd file
To configure the htpasswd identity provider, create an htpasswd file so usernames and hashed passwords are available for the cluster secret. The following procedures describe how to create the file on Linux and Windows Operating Systems.
-
Creating an
htpasswdfile using Linux -
Creating an
htpasswdfile using Windows
Creating an htpasswd file using Linux
Create a flat htpasswd file on Red Hat Enterprise Linux (RHEL) with the htpasswd utility to store usernames and hashed passwords for your cluster. The file enables the htpasswd identity provider to authenticate users in Red Hat OpenShift Container Platform from locally stored credentials.
-
You have access to the
htpasswdutility. On Red Hat Enterprise Linux (RHEL), this is available by installing thehttpd-toolspackage.
-
Create or update your
htpasswdfile with a username and hashed password by running the following command:$ htpasswd -c -B -b </path/to/users.htpasswd> <username> <password>The command generates a hashed version of the password.
For example:
$ htpasswd -c -B -b users.htpasswd <username> <password>Example outputAdding password for user user1 -
Continue to add or update credentials to the file by running the following command:
$ htpasswd -B -b </path/to/users.htpasswd> <user_name> <password>
Creating an htpasswd file using Windows
Create a flat htpasswd file on Windows with the htpasswd.exe utility to store usernames and hashed passwords for your cluster. The file enables the htpasswd identity provider to authenticate users in Red Hat OpenShift Container Platform from locally stored credentials.
-
You have access to the
htpasswd.exeutility. On Windows, this utility is included in the\binsubdirectory of many Apache httpd distributions.
-
Create or update your
htpasswdfile with a username and hashed password by running the following command:$ htpasswd.exe -c -B -b <\path\to\users.htpasswd> <username> <password>The command generates a hashed version of the password.
For example:
$ htpasswd.exe -c -B -b users.htpasswd <username> <password>Example outputAdding password for user user1 -
Continue to add or update credentials to the file by running the following command:
$ htpasswd.exe -b <\path\to\users.htpasswd> <username> <password>