LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 11-14-2010, 06:43 AM   #1
cbass
LQ Newbie
 
Registered: Aug 2010
Posts: 4

Rep: Reputation: 0
Apache IP based authentication


Hi all,

I'm trying to set up an Apache server (version 2.2.16 (Ubuntu)).

This is only the second time I've done it, so I'm taking baby steps. I'm planning on having my homepage visible only within the LAN (192.168.0), and a few other authenticated pages accessible from the www, via a no-ip type url.

I'm falling at the first hurdle; I can't get ip-based authentication to work. This is a snippet from my sites-available/default:
Code:
  3     DocumentRoot "/srv/www"
  4 
  5     <Directory "/srv/www/">
  6         Options Indexes FollowSymLinks MultiViews
  7         AllowOverride None
  8         Order deny,allow
  9         Deny from all
 10         Allow from 192.168.0
 11     </Directory>
My interpretation of the Apache docs is that this should allow access from all machines within the 192.168.0 network, but it doesn't allow any access. All I get is:

Code:
Forbidden
You don't have permission to access /
on this server.
If I remove lines 8-10, it works fine, but doesn't restrict the access as I would like.

What am I doing wrong?

Thanks in advance,

Charlie

Last edited by cbass; 11-14-2010 at 06:56 AM.
 
Old 11-14-2010, 07:59 AM   #2
grim76
Member
 
Registered: Jun 2007
Distribution: Debian, SLES, Ubuntu
Posts: 308

Rep: Reputation: 50
I think you have to flip lines 9 and 10. That way your last directive is your deny.
 
Old 11-14-2010, 08:01 AM   #3
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Hi and welcome to LQ,

These lines are correct.
Just a silly question: Are you sure that your LAN IP is 192.168.0.x?

Regards
 
Old 11-14-2010, 10:08 AM   #4
cbass
LQ Newbie
 
Registered: Aug 2010
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by bathory View Post
Hi and welcome to LQ,

These lines are correct.
Just a silly question: Are you sure that your LAN IP is 192.168.0.x?

Regards
100%. I manage the router at 192.168.0.1. With the Order/Allow/Deny directives removed, I can point a browser to 192.168.0.1 and the index.html shows fine. Can ssh into the server by IP as well.

I've had a bit of a poke around. I changed the order to allow,deny and allowed from 192.168.0 . This let me access the homepage from within the lan, but not from the server itself.

So I added 127.0.0.1 to the allow from directive. Now it all works.

Thanks for your help.
 
Old 11-14-2010, 10:31 AM   #5
blue_print
Member
 
Registered: May 2010
Location: In world
Distribution: RHEL, CentOS, Ubuntu
Posts: 275
Blog Entries: 3

Rep: Reputation: 50
You will need to change "Allow From" as like this one,

Allow From 192.168.0.0/24
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LDAP-based authentication for Samba - help mania2211 Linux - Server 3 07-25-2010 10:30 AM
Squid Proxy with User Based Authentication. nishith Linux - Server 1 07-05-2009 04:24 PM
Apache redirect based on LDAP authentication starmonche Linux - Server 3 03-21-2008 10:42 AM
LXer: LDAP-Based Authentication for Samba LXer Syndicated Linux News 0 02-02-2006 01:01 PM
User based Authentication in Squid instead of Terminal based. TSK2000 Linux - Software 1 12-30-2005 02:22 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 12:27 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration