I'm trying to modify /etc/ssh/sshd_config
on my dedicated debian7 server with both AllowUsers
and AllowGroups
. However I can't seem get both to work together.
The Setup
- There's a user called
testuser
. That user is in a group called
ssh-users
:$ groups testuser testuser : testuser ssh-users
testuser
is trying to connect viassh testuser@<server_ip>
and entering their password.- My
sshd_config
can be found here: http://pastebin.com/iZvVDFKL - I think basically the only changes I made from default was:- to set
PermitRootLogin no
- and add two users with
AllowUsers
(actual usernames differ on my server)
- to set
service ssh restart
is run each time after modifyingsshd_config
.
The Problem
testuser
can connect when set withAllowUsers
:AllowUsers user1 user2 testuser
testuser
can NOT connect when settingAllowGroups
for its group:AllowUsers user1 user2 AllowGroups ssh-users
which results in
Permission denied, please try again.
whentestuser
enters their password in the ssh password prompt.
The Question
- Does
AllowUsers
overrideAllowGroups
? - What's the best way to fix this without manually adding the username to
AllowUsers
? Ideally I'd like to be able to just add users to thessh-users
group in the future without having to touchsshd_config
again.
Ideally I'd like to be able to just add users to the ssh-users group in the future without having to touch sshd_config again.
- So why are you using AllowUsers at all? Just put everyone in the group/groups.