Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.htaccess protect folder without username

Tags:

.htaccess

Is it possible to protect a folder with .htaccess by asking just a password?

I don't want a username.

like image 304
Rais Jean Mehdi Avatar asked Aug 24 '12 16:08

Rais Jean Mehdi


People also ask

How do I password protect a folder in Apache server?

Create the password file The htpasswd command can be used to either create a password file or add an entry to it. For this first time, we will use the -c flag to create the file and add the username jdoe: CentOS 7:sudo htpasswd -c /etc/httpd/. htpasswd jdoe.

How do I password protect just one file?

Use encryption to password protect a folder or a file Navigate to the folder or file you want to encrypt. Right-click on the item, click Properties, then click Advanced. Check Encrypt contents to secure data. Click OK, then click Apply.


1 Answers

HTTP auth will always ask for a username and password, and not just a password. The server doesn't generate the form that pops up, your browser does. And that form will always have a username and password. You can't tell it to only ask for a password.

But what you can do is generate an htpasswd file with a blank username so when the login window opens, people only need to enter a password and can leave the username field blank.

like image 57
Jon Lin Avatar answered Sep 18 '22 01:09

Jon Lin