LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 11-05-2013, 08:37 AM   #1
lpa
LQ Newbie
 
Registered: Jul 2009
Posts: 6

Rep: Reputation: 0
SSH - AllowUsers does not work for some reason


I want to allow logins into my Debian server only from 3 IP addresses.

I added the following line on top of the /etc/ssh/sshd_config file:

PHP Code:
AllowUsers = *@IP_ADDRESS_1, *@IP_ADDRESS_2, *@IP_ADDRESS_3 
Restarted SSH:

PHP Code:
/etc/init.d/ssh restart 
This does not work. I still can login from any IP address.

Than I tried this:

PHP Code:
AllowUsers username1@IP_ADDRESS_1username1@IP_ADDRESS_2username1@IP_ADDRESS_3 
The same problem - I can login from any IP address.

Any ideas?
 
Old 11-05-2013, 09:19 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Have you tried using this:
Code:
AllowUsers *@ip_address_1
AllowUsers *@ip_address_2
AllowUsers *@ip_address_3
You can also mix things up:
Code:
AllowUsers user_1@ip_address_1
AllowUsers *@ip_address_2
AllowUsers user_3@ip_address_3
 
Old 11-05-2013, 01:14 PM   #3
mboelen
LQ Newbie
 
Registered: Nov 2013
Location: The Netherlands
Distribution: Several ones for testing purposes
Posts: 15

Rep: Reputation: Disabled
Try a single line first. So you can rule out the usage of three params.
 
Old 11-06-2013, 01:43 AM   #4
lpa
LQ Newbie
 
Registered: Jul 2009
Posts: 6

Original Poster
Rep: Reputation: 0
I will use hosts.allow hosts.deny instead of AllowUsers which really doesn't work.
 
Old 11-06-2013, 01:52 AM   #5
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
Hi,

from the sshd_config man page:
Code:
     AllowUsers
             This keyword can be followed by a list of user name patterns, separated by spaces.
Have you tried removing the commas?

Evo2.
 
Old 11-06-2013, 02:30 AM   #6
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,307
Blog Entries: 3

Rep: Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721
Match

[s]I'm not aware that AllowUsers or AllowGroups uses anything other than names. No addresses should be allowed, at least according to the manual page. If you are trying to limit access to specific users when they come only from specific addresses, then you need to use the Match option instead. See the manual page for sshd_config for the details.[/s]

Last edited by Turbocapitalist; 11-06-2013 at 03:12 AM.
 
Old 11-06-2013, 03:09 AM   #7
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
Hi,
Quote:
Originally Posted by Turbocapitalist View Post
I'm not aware that AllowUsers or AllowGroups uses anything other than names. No addresses should be allowed, at least according to the manual page.
What sshd are you using?

From sshd_config(5) man page from the openssh-server 1:6.2p2-6 package in Debian:
Code:
     AllowUsers
             This keyword can be followed by a list of user name patterns, separated by spa‐
             ces.  If specified, login is allowed only for user names that match one of the
             patterns.  Only user names are valid; a numerical user ID is not recognized.
             By default, login is allowed for all users.  If the pattern takes the form
             USER@HOST then USER and HOST are separately checked, restricting logins to par‐
             ticular users from particular hosts.
Evo2.
 
Old 11-06-2013, 03:14 AM   #8
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,307
Blog Entries: 3

Rep: Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721
evo2. I stand corrected, even after having read the manual page several times. It's there though I did not see it. Thanks for catching that mistake.

The @HOST option is there in what I have, OpenSSH_6.2p2
 
Old 11-06-2013, 03:38 AM   #9
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Quote:
Originally Posted by lpa View Post
I will use hosts.allow hosts.deny instead of AllowUsers which really doesn't work.
AllowUsers does work. Have you tried my suggestion? Making single entries instead of one long line does work on my side.

Haven't tried evo2's suggestion myself yet (removing the comma's), but it is also worth a try.
 
Old 11-06-2013, 06:35 AM   #10
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
Use a firewall, instead . . .
 
  


Reply

Tags
ssh



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
sshd_conf AllowUsers access jschiwal Linux - Security 5 11-18-2013 03:02 AM
[SOLVED] AllowUsers and AllowGroup not working together snjksh Linux - Security 4 10-09-2013 08:17 AM
sshd_config allowusers allowgroups wolfipa Linux - Software 2 08-02-2007 05:59 AM
For some reason my internet ethernet card just decides not to work mr_coffee Linux - Networking 1 02-04-2006 01:49 PM
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 06:37 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