KodeKloud Engineer htpaccess task done fine, but marked as failed

#Task

Create /var/www/html/sysops direcotry if doesn’t exist.

Add a user mariyam in htpasswd and set its password to LQfKeWWxWD.

There is a file /tmp/index.html placed on Jump Server. Copy the same to new directory you created, please make sure default document root should remain /var/www/html. Also website should work on URL http://:/sysops

#Resolution
Draft of part of commands:
mkdir /var/www/html/sysops

cat < /var/www/html/sysops/index.html
This is xFusionCorp Industries Protected Directory!
EOF

htpasswd -c /var/www/html/sysops/.htpasswd mariyam

cat < /var/www/html/sysops/.htaccess
AuthType Basic
AuthName “Password Required”
Require user mariyam
AuthUserFile /var/www/html/sysops/.htpasswd
EOF

chown -R apache:apache /var/www/html/
chmod 755 -R /var/www/html/

Alias added to /etc/httpd/conf/httpd.conf and httpd restarted. Works fine from localhost and jumphost:

curl -u mariyam:LQfKeWWxWD http://stapp01:8080/sysops - works fine from App01 and from jumphost.

Here is an evidence that only authorized access works fine:

Hello,

Reworked the task, it’s worked fine but it’s failed the check:

Task Status - Failed
  • ‘htpasswd’ authentication is not setup correctly on App Server 3

Required:

Create /var/www/html/dba direcotry if doesn’t exist.

Add a user anita in htpasswd and set its password to ksH85UJjhb.

There is a file /tmp/index.html placed on Jump Server. Copy the same to new directory you created, please make sure default document root should remain /var/www/html. Also website should work on URL http://:/dba

Resolution

mkdir /var/www/html/dba

cat <<EOF > /var/www/html/dba/index.html
This is xFusionCorp Industries Protected Directory!
EOF

htpasswd -c /var/www/html/dba/.htpasswd anita

cat <<EOF > /var/www/html/dba/.htaccess
AuthType Basic
AuthName "Password Required"
Require valid-user
AuthUserFile /var/www/html/dba/.htpasswd
EOF


chown -R apache /var/www/html/dba/ && chmod 644 /var/www/html/dba/

vi /etc/httpd/conf/httpd.conf #Added Alias for /dba
systemctl restart httpd.service && systemctl status httpd.service

curl -u anita:ksH85UJjhb http://stapp01:8080/dba

Works as it should from jumhost: