LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 05-02-2006, 08:04 PM   #1
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
sshd_conf AllowUsers access


I have a question on the meaning of AllowUsers in the /etc/sshd_conf configuration file.
Do you use "AllowUsers username ..." to enforce a deny all except policy versus using "DenyUsers" to just deny certain users.
If you have the entry:
Code:
AllowUsers mike john
Does this mean that all users are denied except for the users "mike" and "john".

The example on page 295 of "Securing and Optimizing Linux: The Ultimate Solution" seems to imply that this is the case.
http://www.tldp.org/LDP/solrhe/Secur...ution-v2.0.pdf

Also, how is AllowGroups used in combination with AllowUsers?
If you have 3 members of the wheel group that you want to allow to log into ssh and allow the users "mike" and "john" access who are not members of the wheel group, would this suffice:
Code:
AllowGroups wheel
AllowUsers mike john
or would the AllowUsers entry take precedence?
Would this combination
Code:
DenyUsers *
AllowGroups wheel sshusers
allow the members of the wheel group and the members of the sshusers group access and deny all other users?

My understanding is that for a workstation or home computer, with a small fixed set of users, using AllowUsers alone is the best plan of action, whereas for a server that has many users connecting, using AllowGroups and denying systems users with DenyUsers to control access and using PAM for authentication would work best.

One last question. Does the order of the Deny and Allow entries make a difference?

Last edited by jschiwal; 05-02-2006 at 08:16 PM.
 
Old 05-02-2006, 09:22 PM   #2
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
Quote:
Originally Posted by jschiwal
Do you use "AllowUsers username ..." to enforce a deny all except policy versus using "DenyUsers" to just deny certain users.
If you have the entry:
Code:
AllowUsers mike john
Does this mean that all users are denied except for the users "mike" and "john".
I use the AllowUsers directive because most of my users don't need ssh access. On my version of OpenSSH (4.3p1 on Slackware) it does mean that all users are denied except mike and john. I have seen other people use AllowGroups and just allow an ssh group so they don't have to restart ssh when adding new users to the system.
Quote:
Originally Posted by jschiwal
Also, how is AllowGroups used in combination with AllowUsers?
On my system, regardless of which line comes first, AllowUsers takes precedence and stops AllowGroups from working.
Quote:
Originally Posted by jschiwal
One last question. Does the order of the Deny and Allow entries make a difference?
On my system, the DenyUsers entry takes precedence over AllowUsers regardless of which order they appear. For example, adding a user to both entries (AllowUsers and DenyUsers) results in the user being denied.

Hope that helps.
 
Old 05-02-2006, 10:14 PM   #3
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Original Poster
Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Thank you for your response.

Quote:
On my system, regardless of which line comes first, AllowUsers takes precedence and stops AllowGroups from working.
I didn't know that AllowUsers trumps AllowGroups. So one of my examples wouldn't work:
AllowUsers mike john
AllowGroups wheel

And instead, I'd need to make a sshusers group and use the line:
AllowGroups wheel sshusers

The sshd_config manpage does not point this out.

Thanks again.
 
Old 05-02-2006, 11:36 PM   #4
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
No problem I checked it again to make sure I had the behaviour right - AllowUsers does override AllowGroups meaning only one of them can be used. I also tried using AllowGroups wheel sshusers and that worked.

Quote:
Originally Posted by jschiwal
The sshd_config manpage does not point this out.
I can't find anywhere (docs or google) that lists the precedence of the hosts/groups/users operators so I'd be interested if you find out more about this.
 
Old 11-17-2013, 04:12 PM   #5
neptuneuk
LQ Newbie
 
Registered: Nov 2013
Posts: 1

Rep: Reputation: Disabled
Lucky I found this post

I was starting to question my own sanity when I found this post. Nowhere else was I able to find any mention of precedence in 'Allowxxxxx' under ssh_conf.

I had users under AllowUsers and had a (has it happens the nx group for FreeNX) under AllowGroups but none of my users could log in despite being members of the nx group.

This solved my issue immediately. Just using AllowGroups now.

Thanks guys. This needs to be documented elsewhere.
 
Old 11-18-2013, 03:02 AM   #6
NM04
Member
 
Registered: Jan 2011
Distribution: Back Track,Fedora,centos
Posts: 240

Rep: Reputation: 14
jschiwal,
about the users and groups, it works same as file permissions,i.e, "users-groups..etc". Priority is given to users first then groups and so on.

Regards,
nm
 
  


Reply

Tags
sshd



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
vsftp - Can access FTP within office network BUT cant access via Internet! kokfei77 Red Hat 2 03-07-2012 07:24 PM
How to access database created with MS Access on Windows using PHP on Linux Server anjani.78 Linux - Software 1 12-21-2005 06:07 PM
WIFI WLAN / Cannot access internet but can access the router configuration page?SUSE thomas939 Linux - Wireless Networking 12 12-13-2005 10:28 AM
Samba access by Windows users locking out directory access with Konqueror harry_fine SUSE / openSUSE 1 12-18-2004 05:33 AM
AllowUsers in sshd_config Won't Use IP Range lnxconvrt Linux - Security 4 11-28-2004 11:28 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 12:01 AM.

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