Home > Workload Solutions > Container Platforms > Red Hat OpenShift Container Platform > Guides > Implementation Guide—Red Hat OpenShift Container Platform 4.14 on AMD-powered Dell Infrastructure > Configure OpenShift Container Platform authentication
OpenShift Container Platform supports different authentication methods based on the identity provider. For more information, see Understanding authentication.
This section describes how to configure users using the htpasswd identity provider.
Note: Unless otherwise specified, run the following commands on the primary CSAH node as user core.
To create an admin user:
[core@csah ~]$ cd /home/core/openshift
[core@csah openshift]$ htpasswd -c -B -b htpasswd ocpadmin Password1
[core@csah openshift]$ htpasswd -b htpasswd ocpuser Password2
[core@csah openshift]$ oc create secret generic htpass-secret --from-file=htpasswd=/home/core/openshift/htpasswd -n openshift-config
apiVersion: config.openshift.io/v1
kind: OAuth
metadata:
name: cluster
spec:
identityProviders:
- name: htpasswd
mappingMethod: claim
type: HTPasswd
htpasswd:
fileData:
name: htpass-secret
[core@csah ~]$ oc apply -f <file name>
[core@csah ~]$ oc login -u <username>
Authentication required for https://api. ocp414-amd.dcws.lab:6443 (openshift)
Username: <username>
Password: <password>
Login successful.
You don’t have any projects. You can try to create a new project, by running oc new-project <projectname>
To assign a cluster-admin role to the admin user:
[core@csah openshift]$ oc login -u kubeadmin -p xxxxx-xxxxx-xxxxx-xxxxx-xxxxx
The following code excerpt shows sample command output:
Login successful.
You have access to 53 projects, the list has been suppressed. You can list all projects with ‘oc projects’
Using project “default”.
[core@csah ~]$ oc get users
NAME UID FULL NAME IDENTITIES
ocpadmin 273ccf25-9b32-4b4d-aad4-503c5aa27eee htpasswd:ocpadmin
[core@csah ~]$ oc get clusterrole --all-namespaces
[core@csah ~]$ oc adm policy add-cluster-role-to-user cluster-admin ocpadmin
clusterrole.rbac.authorization.k8s.io/cluster-admin added: “ocpadmin”