how do I poassword protect a directory on a website, Apache
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
how do I poassword protect a directory on a website, Apache
I know how to password protect a directory on a whole website. But what do I do if I have a site line www.site.com/private .
I want to put password protection just for the "private" sub-directory and not the rest of the site. Thanks in advanced
riiiiight....that still doesn't tell me how to do it for just one directory in the website. I have already looked at that document anyway. It doesn't really tell me how to do it for one directory. Can anyone give an example, I will understand it better then. In my virtual hosts section, what would I do to add basic authenication to just one directory in the website?
Well, you place the .htaccess file in the directory you want to protect.. just take note it will ask for a username and password if that one directory has any subdirectories.. but that is what your looking for, I promise
Thanks guys. When I try thought I get error 1049 AuthUserFile not allowed here.
Also I have a wierd set up. I have a directory with a lot of files. So I want to password protect that directy. However the directory isn't on that server. here is the setup.
I have a web server running LAMP I'll call it server1.
I have another server with a lot of files, running NFS, server2.
I exported a directory called "files" in etc/files for example. in etc/exports.
I mounted server2:/etc/files in /mnt/files.
Then in the web directory I created a link called private to /mnt/files.
I did this ln-s /mnt/files /user/site/private
I did this because server2 has a ver large hard drive and I have a lot of files. It's running samba to, so I just drop files into it from my widows box and I am set.
It works great and I have no problems acces the stuff. I just want to password protect that directory. I also noticed I can't add the .htaccess file to the .private directory because it doesn't actually reside on that machine. so I added it to the root of the site ultimately and got this error.
ErrorDocument 401 rejection.html
AuthUserFile /home/wasiq/.htpass
AuthGroupFile /dev/null
AuthName "Book-O-Rama"
AuthType Basic
Require user [username]
the above needs to be in the directory directive.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.