Solved

Setting Apache Security

Posted on 2002-03-05
11
247 Views
Last Modified: 2010-03-04
I'm now using Apache as my sever running on linux..
I don't wanna let others to access the files stored on Apache....
Eg...one can access the files inside test folder using the following link:
174.75.84.32/test/  
how can I prevent others from accessing the files using the method mentioned above?
0
Comment
Question by:usher
  • 4
  • 2
  • 2
  • +1
11 Comments
 
LVL 1

Accepted Solution

by:
johnnyp earned 25 total points
ID: 6841551
You can restrict access to your website and any virtual sites on it through the httpd.conf file.

In the global config, within the <Directory> tags for the default DocumentRoot there is an allow,deny section: where you can configure access for individual IP's, hostnames, subnets or domains.

If you simply want to deny access to the /test/ directory, you can configure security through .htaccess files.

Can you be a little more specific with what you want to deny access to, the whole website or just trees from the top level?  Once you let me know, I can go into a little more detail.

0
 

Author Comment

by:usher
ID: 6843394
Actually I intend to set security so that no one can access our sever and steal files from it...

0
 
LVL 1

Expert Comment

by:johnnyp
ID: 6843896
So we are talking purely from a filesystem point of view.  At which point you can use a filewall solution which is shipped with most Linux versions.  RedHat comes with IPCHAINS.

Slightly less intense than a firewall would be to use TPC Wrappers in which you can configure specific inetd or xinetd available daemons to be accessible from selected hosts or domains as I stated in my previous post.

If this is the sort of thing your looking for?
0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 

Author Comment

by:usher
ID: 6844474
Actually I'm not that familiar with Apache
I have a folder stored under this directory:
apache_1.3.22\htdocs\interface

How can I set things in order to protect the files "interface" under this directory?

0
 

Assisted Solution

by:tommyh
tommyh earned 25 total points
ID: 6862859
create a .htaccess file and put in the directory you wish to protect, it should contain something like;

AuthUserFile </path/.htpasswd>
AuthGroupFile /dev/null
AuthName "Not worth looking at really, so go away"
AuthType Basic

<Limit GET POST>
require valid-user
</Limit>

where you should replace </path/.htpasswd> with a full path to a folder outside your webroot.

and then cd to the directory you specified in </path/.htpasswd> and run;
htpasswd -c .htpasswd <username> <password>

where username and password are replaced with something suitable, and hey presto, that folder should request a username and password for users browsing items in the folder.



0
 

Author Comment

by:usher
ID: 6866576
Some told me that that's a file storing all the config files for apache...
Do u know where and what's the name of that file?
Btw, would you mind telling me which config file I should change so that the server will send an email automatically to administrator in case the server has problem?
0
 

Expert Comment

by:tommyh
ID: 6868466
the httpd.conf file can be in various places.

/etc/httpd/conf/httpd.conf

is where it is on my linux box,

also you will need to restart httpd if you make any changes.

service httpd restart

or sometimes

apachectl restart



0
 

Author Comment

by:usher
ID: 6894125
How about if I would like to achieve the followings:
When I go to eg http://192.45.23.52/interface/
it will display all the files containing in the interface folder....how could I change the setting so that when people access this link http://192.45.23.52/interface/
it will prompt to a error page instead of allowing people view the files?
0
 
LVL 15

Assisted Solution

by:samri
samri earned 25 total points
ID: 6927299
usher,

By default apache will deny directory listing (At least on 1.3.22 RH7.2).  One option to deny Directory listing is to create an index.html file (or whatever filel defined in DirectoryIndex directive)

a index.html will the following content would do.
----------
<html>
<head>
</head>

<body></body>
</html
----------
0
 
LVL 15

Expert Comment

by:samri
ID: 6927303
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
URL rewriting - LAMP 7 41
Website being blocked? 3 126
php54-php-imap for redhat enterprise linux 7.2 1 87
instanceof  operator in java 26 91
Over the last year I have answered a couple of basic URL rewriting questions several times so I thought I might as well have a stab at: explaining the basics, providing a few useful links and consolidating some of the most common queries into a sing…
If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question