LinuxSecurity.com
Share your story
The central voice for Linux and Open Source security news
Home News Topics Advisories HOWTOs Features Newsletters About Register

Welcome!
Sign up!
EnGarde Community
Login
Polls
What is the most important Linux security technology?
 
Advisories
Community
Linux Events
Linux User Groups
Link to Us
Security Center
Book Reviews
Security Dictionary
Security Tips
SELinux
White Papers
Featured Blogs
All About Linux
DanWalsh LiveJournal
Securitydistro
Latest Newsletters
Linux Advisory Watch: August 29th, 2014
Linux Security Week: August 25th, 2014
Subscribe
LinuxSecurity Newsletters
E-mail:
Choose Lists:
About our Newsletters
RSS Feeds
Get the LinuxSecurity news you want faster with RSS
Powered By

  
Passwording a file using Apache Print E-mail
User Rating:      How can I rate this item?
Source: Ryan W. Maple - Posted by Ryan W. Maple   
Learn tips and tricks Sensitive information that only certain people need to have web access to must be secured.

Sensitive information that only certain people need to have web access to must be secured.

If sensitive or proprietary information is located on your web site and you do not want public access to this information, you must password it. An obscure file name with no links to it anywhere on the site will not keep the information secure. Security through obscurity does not work.

To password a file, a series of files or a directory in Apache, the httpd.conf file must be edited. Then, a database of usernames and passwords must be created.

  <Location /secret.*>
        AuthType Basic
        AuthName "Secret"
        AuthUserFile /usr/local/apache/users
        require valid-user
  </Location>

In this example, all files that begin with secret. will require authentication. If only one file needed to be password protected, the example could be changed to:

  <Location /secret.txt>

Similarly, if a directory needed to be password protected, the example could be changed to this:

  <Location /secret/>

Now back to the original example, the authentication type is basic, meaning it is just a text file, not a true database. When someone tries to go to one of the pages that is protected, the box that asks for a username and password will be titled Secret. The text file with the usernames and passwords will be called users and be located in the /etc/httpd/conf directory. According to the require field, any user in the users file is allowed access.

To set up the text file with usernames and passwords, the program htpasswd must be used. It is located in the bin directory when you install apache. The syntax is very simple for this program. The first time htpasswd is run for the users file, it should be called like this:

  root# /usr/bin/htpasswd -m -c filename username

In our example, it would look something like this:

  root# /usr/bin/htpasswd -m /etc/httpd/conf/users canisab

For more information about this and similar things, go to http://www.apache.org. Also, there are great books such as Apache: The Definitive Guide by Ben and Peter Laurie.

Only registered users can write comments.
Please login or register.

Powered by AkoComment!

 
< Prev   Next >
    
Partner

 

Latest Features
Peter Smith Releases Linux Network Security Online
Securing a Linux Web Server
Password guessing with Medusa 2.0
Password guessing as an attack vector
Squid and Digest Authentication
Squid and Basic Authentication
Demystifying the Chinese Hacking Industry: Earning 6 Million a Night
Free Online security course (LearnSIA) - A Call for Help
What You Need to Know About Linux Rootkits
Review: A Practical Guide to Fedora and Red Hat Enterprise Linux - Fifth Edition
Weekend Edition
How Cops and Hackers Could Abuse California’s New Phone Kill-Switch Law
Why Russian hackers are beating us
DQ Breach? HQ Says No, But Would it Know?
Partner Sponsor

Community | HOWTOs | Blogs | Features | Book Reviews | Networking
 Security Projects |  Latest News |  Newsletters |  SELinux |  Privacy |  Home
 Hardening |   About Us |   Advertise |   Legal Notice |   RSS |   Guardian Digital
(c)Copyright 2014 Guardian Digital, Inc. All rights reserved.