Gentoo Archives: gentoo-user

From: Grant <emailgrant@×××××.com>
To: Gentoo mailing list <gentoo-user@l.g.o>
Subject: Re: [gentoo-user] Restrict certain web users by IP
Date: Thu, 29 Nov 2012 19:56:57
Message-Id: CAN0CFw2hJrTumOOB6=QoOPGKyNnjwg93U0oGEJ6XyR_nT1v2rg@mail.gmail.com
In Reply to: Re: [gentoo-user] Restrict certain web users by IP by Joseph
1 >> >> I use apache2 authentication for web users and I would like to
2 >> require
3 >> >> logins from certain users to be from a certain IP address. I
4 >> >> experimented with Allow and Require but couldn't find a way to
5 >> restrict
6 >> >> only certain users. Can this be done via apache2 authentication
7 >> or
8 >> >> should I use another method?
9 >> >>
10 >> >> - Grant
11 >> >
12 >> >
13 >> > very simple via .htaccess
14 >> >
15 >> > <Limit GET POST>
16 >> > order deny,allow
17 >> > deny from all
18 >> > allow from IP_address
19 >> > </Limit>
20 >> >
21 >> > AuthName "restricted stuff"
22 >> > AuthType Basic
23 >> > AuthUserFile /etc/apache2/users
24 >> > require user webmaster
25 >>
26 >> I think that will require any usernames specified to come from
27 >> IP_address. I'm trying to allow certain usernames to come from any IP,
28 >> and restrict other usernames to a certain IP. Can that be done via
29 >> .htaccess?
30 >>
31 >> - Grant
32 >
33 >
34 > You originally wanted "...logins from certain users to be from a certain
35 IP address"
36 > Now, you want from "any IP" In this case just restrict users with:
37 >
38 >
39 > AuthName "restricted stuff"
40 > AuthType Basic
41 > AuthUserFile /etc/apache2/users
42 > require user webmaster
43 >
44 > Just assign "password and user" from root:
45 > # htpasswd2 -c /etc/apache2/users your-user-name
46
47 I'm sorry I haven't been clear about this. Sometimes an example is the
48 best way.
49
50 I want users jack and jill to be able to access the web content from any IP
51 address, and I want users john and jacob to be able to access the web
52 content only if they are coming from a certain IP address. I don't want
53 anyone else to have access.
54
55 - Grant

Replies

Subject Author
Re: [gentoo-user] Restrict certain web users by IP Alan McKinnon <alan.mckinnon@×××××.com>
Re: [gentoo-user] Restrict certain web users by IP Joseph <syscon780@×××××.com>