Gentoo Archives: gentoo-user

From: Joseph <syscon780@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Restrict certain web users by IP
Date: Thu, 29 Nov 2012 17:57:47
Message-Id: 20121129175559.GB14272@syscon7.inet
In Reply to: Re: [gentoo-user] Restrict certain web users by IP by Grant
1 On 11/28/12 20:10, Grant wrote:
2 > >> I use apache2 authentication for web users and I would like to
3 > require
4 > >> logins from certain users to be from a certain IP address. I
5 > >> experimented with Allow and Require but couldn't find a way to
6 > restrict
7 > >> only certain users. Can this be done via apache2 authentication
8 > or
9 > >> should I use another method?
10 > >>
11 > >> - Grant
12 > >
13 > >
14 > > very simple via .htaccess
15 > >
16 > > <Limit GET POST>
17 > > order deny,allow
18 > > deny from all
19 > > allow from IP_address
20 > > </Limit>
21 > >
22 > > AuthName "restricted stuff"
23 > > AuthType Basic
24 > > AuthUserFile /etc/apache2/users
25 > > require user webmaster
26 >
27 > I think that will require any usernames specified to come from
28 > IP_address. I'm trying to allow certain usernames to come from any IP,
29 > and restrict other usernames to a certain IP. Can that be done via
30 > .htaccess?
31 >
32 > - Grant
33
34 You originally wanted "...logins from certain users to be from a certain IP address"
35 Now, you want from "any IP"
36 In this case just restrict users with:
37
38 AuthName "restricted stuff"
39 AuthType Basic
40 AuthUserFile /etc/apache2/users
41 require user webmaster
42
43 Just assign "password and user" from root:
44 # htpasswd2 -c /etc/apache2/users your-user-name
45
46 --
47 Joseph

Replies

Subject Author
Re: [gentoo-user] Restrict certain web users by IP Grant <emailgrant@×××××.com>