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 htpasswd file using Linux

  • Creating an htpasswd file 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.

Prerequisites
  • You have access to the htpasswd utility. On Red Hat Enterprise Linux (RHEL), this is available by installing the httpd-tools package.

Procedure
  1. Create or update your htpasswd file 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 output
    Adding password for user user1
  2. 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.

Prerequisites
  • You have access to the htpasswd.exe utility. On Windows, this utility is included in the \bin subdirectory of many Apache httpd distributions.

Procedure
  1. Create or update your htpasswd file 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 output
    Adding password for user user1
  2. Continue to add or update credentials to the file by running the following command:

    $ htpasswd.exe -b <\path\to\users.htpasswd> <username> <password>