LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 10-07-2008, 09:45 PM   #1
mamtasahai1
Member
 
Registered: Jan 2007
Location: India
Distribution: RHEL 5, Fedora 9, Solaris, FreeBSD
Posts: 52

Rep: Reputation: 15
Thumbs up Apache - authentication for user and group


Hi All, I am running an Apache Server and want to give access to a user "mam" and a group "sales". When I m using "require group sales" with "require user mam" only mam user can access the site, If I use it without "require user mam", users of sales group can access the site. Please tell me how can I use both at same time.

My .htaccess file is
AuthName "password protected"
AuthType Basic
AuthUserFile /etc/httpd/.htpasswd
AuthGroupFile /etc/httpd/.htgroup
require user mam
require group sales

My .htgroup File is

sales : user1, user2

All users are added in .htpasswd file
 
Old 10-07-2008, 11:49 PM   #2
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 63
Require is exclusive:

Code:
Require user userid [userid] ...
    Only the named users can access the resource.

Require group group-name [group-name] ...
    Only users in the named groups can access the resource.
Create a group that contains both mam and sales, and configure:
Code:
Require group biggroup
 
Old 10-08-2008, 02:08 AM   #3
mamtasahai1
Member
 
Registered: Jan 2007
Location: India
Distribution: RHEL 5, Fedora 9, Solaris, FreeBSD
Posts: 52

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Mr. C. View Post
:

Create a group that contains both mam and sales
Plz tell me how can i do this.. what I tried..I added a group biggroup and in /etc/group file i modified this
sales:x:101:user1,user2
biggroup:x:102:sales,mam

and in .htgroup file
biggroup : sales mam

in .htaccess
Require group biggroup

Now only "mam" user is able to access the site.

Last edited by mamtasahai1; 10-08-2008 at 02:17 AM.
 
Old 10-08-2008, 02:53 AM   #4
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 63
Groups contain a list of users. From the apache manual:

Quote:
AuthGroupFile Directive
...
Each line of the group file contains a groupname followed by a colon, followed by the member usernames separated by spaces.
http://httpd.apache.org/docs/2.2/mod...groupfile.html
 
Old 10-08-2008, 03:07 AM   #5
mamtasahai1
Member
 
Registered: Jan 2007
Location: India
Distribution: RHEL 5, Fedora 9, Solaris, FreeBSD
Posts: 52

Original Poster
Rep: Reputation: 15
Quote:
and in .htgroup file
biggroup : sales mam
.
I hv already mention this in my post. Please check my configuration and tell me where I m wrong..
 
Old 10-08-2008, 03:11 AM   #6
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 63
USERNAMES... not GROUPNAMES. The name "sales" is a group name, right!?
 
Old 10-08-2008, 03:39 AM   #7
mamtasahai1
Member
 
Registered: Jan 2007
Location: India
Distribution: RHEL 5, Fedora 9, Solaris, FreeBSD
Posts: 52

Original Poster
Rep: Reputation: 15
Yes.
- sales is the group and its members are user1 and user2
- mam is the user who doesn't belong sales group
 
Old 10-08-2008, 03:46 AM   #8
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 63
List all USERNAMEs in .htgroup:

biggroup : mam user1 user2

Do not list GROUPNAMES as members.
 
Old 10-08-2008, 03:58 AM   #9
mamtasahai1
Member
 
Registered: Jan 2007
Location: India
Distribution: RHEL 5, Fedora 9, Solaris, FreeBSD
Posts: 52

Original Poster
Rep: Reputation: 15
Yes. It will work because it will act as new gruop with three members.
I want to give the permission for existing sales group as welll as some users to access the site. can I do this?

Last edited by mamtasahai1; 10-08-2008 at 03:59 AM.
 
  


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
problem with a user group and apache javier_ccs Linux - Software 7 07-28-2011 03:53 AM
Apache and system user authentication filburt1 Linux - Newbie 1 07-27-2006 04:19 PM
how to change apache user and group gerilaradio Slackware 7 12-17-2005 10:10 PM
Apache 2.0.53, vhost, each having its own user:group Davus Linux - Software 1 02-27-2005 11:44 PM
Apache Webserver 403 Forbidden Errors (User not in apache group?) Mankind75 Mandriva 4 07-08-2004 05:30 AM

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

All times are GMT -5. The time now is 07:42 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