202-450 Exam QuestionsBrowse all questions from this exam

202-450 Exam - Question 31


In order to protect a directory on an Apache HTTPD web server with a password, this configuration was added to an .htaccess file in the respective directory:

Furthermore, a file /var/www/dir/ .htpasswd was created with the following content: usera:S3cr3t

Given that all these files were correctly processed by the web server processes, which of the following statements is true about requests to the directory?

Show Answer
Correct Answer: AD

The configuration provided in the .htaccess file is set up to use basic authentication with a password file located at /var/www/dir/.htpasswd. However, the password in the .htpasswd file is given in plaintext (usera:S3cr3t), which is not how Apache expects it. Apache expects the password to be encrypted. As a result, even though the user is prompted for a username and password, the login would fail because the password encryption does not match. This would cause the browser to continuously prompt the user for login credentials without granting access.

Discussion

17 comments
Sign in to comment
juerwareOption: D
Oct 31, 2021

The correct anwser is D, it gets constanly asking for login and password. I have proven it in debian 11 with apache2 service with following configuration: # htpasswd -c /var/www/html/.auth usera hellowworld <Directory "/var/www/html/"> AuthName "Private section aramirez" AuthType Basic # AuthBasicProvider file # this is the default value AuthUserFile "/var/www/html/.auth" Require valid-user </Directory> if password is encrypted in .auth file it works right, if not then it gets repeating asking for login/passsword

lite2000Option: A
Jul 25, 2020

It is A, the answer is correct because that user was created just for that purpose, I am just seeing Linux Academy videos and when you create a user in the .htaccess file it works when you login with those credentials.

roach7
Mar 13, 2021

No that is not correct. Apache expects an encrypted password in .htpasswd. In this case it is not true. The password was written in plaintext in the .htpasswd file. It should have been created using htpasswd -c /var/www/dir.htpasswd usera (after the prompt type in the password)

ArminaOption: D
Feb 6, 2022

D is correct! we have created a .htaccess file and set the contents of the file to be: # AuthType Basic # AuthName "Authentication Required" # AuthUserFile "/etc/htpasswd/.htpasswd" # Require valid-user - Notice: It was just used wrongly the same content of htpasswd which is “s3cr3t” which causes the problem of “Answer D” and password is not correct.

EMordentiOption: A
Apr 21, 2022

The option "A" is the correct answer. The password field in the ".htpasswd" file, if generated by the "htpasswd" command, is not stored in plain text by default, but can be used by providing the "-p" parameter. The "htpasswd" command uses MD5 hashing by default (parameter "-m") and the ".htpasswd" file will look like this usera:$apr1$FMvyPFsQ$CQNQc/lfAiHNaOIjA6a.K/ For additional security, bcrypt is often used for the hash (parameter "-B") and the ".htpasswd" file would look like this usera:$2y$05$7svvma1IcvF1PMBI4HW2EOcFH9Vguhh73S4xEMGhhv5Xn7fUFM1DK The ".htpasswd" file provided in the question shows that it uses clear codes to store passwords. If "Require" is set to "valid-user", any user present in the ".htpasswd" file will be able to access the resources in the file by providing the correct password. If the user's password is not validated, an HTTP 401 (Authorisation Required) status will be returned.

LantosOption: D
May 12, 2023

In the case of "AuthType Basic" Apache will read a hashed password from the password file, so a hashed password should be stored in the password file! In the situation mentioned by the task, access denied will be the result because of a wrong password. (Answer D is true) We should make a difference between .htpasswd and .htaccess!

linuxkrOption: A
Aug 31, 2021

If the password field in the ".htpasswd" file is generated using the "htpasswd" command, it will not be saved in clear code by default, but clear code can be used by providing the "-p" parameter. From the ".htpasswd" file provided by the title, it can be seen that it uses clear codes to store passwords. If "Require" is set to "valid-user", any user who exists in the ".htpasswd" file can access the file resources by providing the correct password. If the user password authentication fails, the HTTP 401 status (Authorization Required) will be returned. Therefore, option "A" is the correct answer.

ArminaOption: E
Feb 15, 2022

E is correct!

ArminaOption: E
Feb 22, 2022

E 100%. is correct Because “ AllowOverride” is by default none which make the use of “.htaccess” file completely disabled!.

m2t4eus
Jun 16, 2023

" Given that all these files were correctly processed by the web server processes"

marcelo_saadOption: D
Aug 4, 2023

D is correct!

marcelo_saadOption: D
Aug 8, 2023

answer is D

TombaOption: D
Dec 13, 2021

https://httpd.apache.org/docs/2.2/misc/password_encryptions.html Ansert A cannot be correct since clear-text passwords are only supported (though discouraged) on Windows etc. The only question is a space in parameter value there on purpose

ArminaOption: A
Feb 6, 2022

- Please notice also that the AllowOverride line is just in a <Directory> block in httpd.conf Which is not part of question. It tells Apache to process the htaccess file and to allow htaccess to set the authentication for that directory. Supposed AuthConfig is set like following: # AllowOverride AuthConfig, If you don't enter correct credentials, you will be continually prompted to enter credentials until you enter correct credentials or click the Cancel button. and if and only if is the question for Apache httpd 2.4, the authorization mechanism is by default “non” or as follows: # AllowOverride None, which allows public, non-restricted access for a specific directory and a configuration uses basic HTTP authentication if and only if we have NOT created a .htaccess file. That means if we have created a .htaccess file Apache prefer to allow users set in access file with prompting for password.

ArminaOption: A
Feb 7, 2022

In other words in Apache only when AllowOverride is set to allow the use of .htaccess files (AllowOverride all) , httpd will look in every directory for .htaccess files. Please see the default setting which make the use of “.htaccess” file completely disabled!. in Ubuntu/, Debian Directory /var/www/> Options Indexes FollowSymLinks AllowOverride None Require all granted </Directory> on CentOs: <Directory "/var/www"> AllowOverride None # Allow open access: Require all granted # Further relax access to the default document root: <Directory "/var/www/html">

lbellicOption: A
Mar 2, 2023

The answer is A : assuming that the command htpasswd is executed with option "plain text" (-p) cause the file cannot be manually created

shawarovOption: A
Mar 25, 2023

A according to chatGPT

m2t4eusOption: A
Jun 16, 2023

" Given that all these files were correctly processed by the web server processes"

MaikyCR28Option: A
Sep 1, 2023

A. "The user usera can access the site using the password s3cr3t", the password on the htpasswd file is "S3cr3t" with capital "S". B. No, the user does exists in the htpasswd file. C. Error code 500 means there's a web server error, according to the provided configuration. There shouldn't be a problem preventing the website from loading D. How do we know the login for usera didn't work if the entered password is not mentioned? E. In normal aspects, the web content should be delivered to the user. I don't think the E answer is the 100% correct, but I think is more logic than the previous ones.