Configure protected directories in Apache-Task shows failed even got the desired result on terminal


thor@jump_host /$ ssh banner@stapp03
The authenticity of host ‘stapp03 (172.16.238.12)’ can’t be established.
ECDSA key fingerprint is SHA256:SySamszyWhhLGFiybhGBqfrr8g55wS/3e37ZpBOvICs.
ECDSA key fingerprint is MD5:6d:31:18:2a:f9:07:f3:29:dd:0a:d3:1f:6e:04:0a:db.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘stapp03,172.16.238.12’ (ECDSA) to the list of known hosts.
banner@stapp03’s password:
[banner@stapp03 ~]$ sudo su

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.

[sudo] password for banner:
[root@stapp03 banner]# ls[root@stapp03 banner]# ls -l
total 0
[root@stapp03 banner]# sudo htpasswd -c /etc/httpd/.htpasswd ravi
New password:
Re-type new password:
Adding password for user ravi
[root@stapp03 banner]# sudo systemctl restart httpd
[root@stapp03 banner]# chown apache:apache /etc/httpd/.htpasswd
[root@stapp03 banner]# chmod 644 /etc/httpd/.htpasswd
[root@stapp03 banner]# sudo vi /etc/httpd/conf/httpd.conf
[root@stapp03 banner]# cd /var
[root@stapp03 var]# ca www
bash: ca: command not found
[root@stapp03 var]# cd www
[root@stapp03 www]# cd html
[root@stapp03 html]# pwd
/var/www/html
[root@stapp03 html]# mkdir sysops
[root@stapp03 html]# ls -l
total 4
drwxr-xr-x 2 root root 4096 Dec 16 00:39 sysops
[root@stapp03 html]# mkdir finance
[root@stapp03 html]# ls -l
total 8
drwxr-xr-x 2 root root 4096 Dec 16 00:40 finance
drwxr-xr-x 2 root root 4096 Dec 16 00:39 sysops
[root@stapp03 html]# cd finance
[root@stapp03 finance]# pwd
/var/www/html/finance
[root@stapp03 finance]# sudo vi .htaccess
[root@stapp03 finance]# exit
exit
[banner@stapp03 ~]$ exit
logout
Connection to stapp03 closed.
thor@jump_host /$ sudo scp -r /tmp/index.html [email protected]:/tmp

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.

[sudo] password for thor:
The authenticity of host ‘172.16.238.12 (172.16.238.12)’ can’t be established.
ECDSA key fingerprint is SHA256:SySamszyWhhLGFiybhGBqfrr8g55wS/3e37ZpBOvICs.
ECDSA key fingerprint is MD5:6d:31:18:2a:f9:07:f3:29:dd:0a:d3:1f:6e:04:0a:db.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘172.16.238.12’ (ECDSA) to the list of known hosts.
[email protected]’s password:
index.html 100% 51 35.0KB/s 00:00
thor@jump_host /$ ssh banner@stapp03
banner@stapp03’s password:
Last login: Wed Dec 16 00:31:44 2020 from jump_host.linuxprotecteddirhttpd_app_net
[banner@stapp03 ~]$ sudo mv /tmp/index.html /var/www/html/finance
[sudo] password for banner:
[banner@stapp03 ~]$ pwd
/home/banner
[banner@stapp03 ~]$ cd /var
[banner@stapp03 var]$ cd www
[banner@stapp03 www]$ cd html
[banner@stapp03 html]$ ls -l
total 8
drwxr-xr-x 2 root root 4096 Dec 16 00:47 finance
drwxr-xr-x 2 root root 4096 Dec 16 00:39 sysops
[banner@stapp03 html]$ cd finance
[banner@stapp03 finance]$ ls -al
total 16
drwxr-xr-x 2 root root 4096 Dec 16 00:47 .
drwxrwxrwx 4 root root 4096 Dec 16 00:40 …
-rw-r–r-- 1 root root 97 Dec 16 00:42 .htaccess
-rw-r–r-- 1 banner banner 51 Dec 16 00:45 index.html
[banner@stapp03 finance]$ ^C
[banner@stapp03 finance]$ cat /var/www/html/finance/index.html
This is xFusionCorp Industries Protected Directory![banner@stapp03 finance]$
[banner@stapp03 finance]$ sudo systemctl restart httpd
[banner@stapp03 finance]$ sudo systemctl status httpd
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
Active: active (running) since Wed 2020-12-16 00:50:58 UTC; 14s ago
Docs: man:httpd(8)
man:apachectl(8)
Process: 445 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=0/SUCCESS)
Main PID: 448 (httpd)
Status: “Total requests: 0; Current requests/sec: 0; Current traffic: 0 B/sec”
CGroup: /docker/1c6a5c781a0139086d4bc4a5dbf2ab2251f67ce4f1b26c11fdce7be36ce5bbea/system.slice/httpd.service
├─448 /usr/sbin/httpd -DFOREGROUND
├─449 /usr/sbin/httpd -DFOREGROUND
├─450 /usr/sbin/httpd -DFOREGROUND
├─451 /usr/sbin/httpd -DFOREGROUND
├─452 /usr/sbin/httpd -DFOREGROUND
└─453 /usr/sbin/httpd -DFOREGROUND

Dec 16 00:50:58 stapp03 systemd[1]: Starting The Apache HTTP Server…
Dec 16 00:50:58 stapp03 httpd[448]: AH00558: httpd: Could not reliably determine the server’s …sage
Dec 16 00:50:58 stapp03 systemd[1]: Started The Apache HTTP Server.
Hint: Some lines were ellipsized, use -l to show in full.
[banner@stapp03 finance]$ curl -u ravi:abcdefg http://stapp03:8080/finance/
This is xFusionCorp Industries Protected Directory![banner@stapp03 finance]$
[banner@stapp03 finance]$ curl -u http://stapp03:8080/finance/
curl: no URL specified!
curl: try ‘curl --help’ or ‘curl --manual’ for more information
[banner@stapp03 finance]$ curl http://stapp03:8080/finance/

401 Unauthorized

Unauthorized

This server could not verify that you are authorized to access the document requested. Either you supplied the wrong credentials (e.g., bad password), or your browser doesn't understand how to supply the credentials required.

[banner@stapp03 finance]$ curl -u ravi:abcdefg http://stapp03:8080/finance/ This is xFusionCorp Industries Protected Directory![banner@stapp03 finance]$

@Praful, as per question, you were asked to set passsword TmPcZjtRQx instead of abcdefg