Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Is there any way to restrict ssh login from specific linux group to specific host?

I want to reach something like "AllowUsers user1@host" for linux groups.

Like: "AllowGroups group@host", but that didn't work.

That is useful because one group can login from all hosts (@host isn't specified), second group only from localhost (for web-based ssh client which forces limited shell)

I read a lot of material from internet, but I wonder that I didn't find anything to cover this problem.

share|improve this question

migrated from stackoverflow.com Oct 30 '11 at 10:36

This question came from our site for professional and enthusiast programmers.

    
Read about the Match keyword in sshd_config. –  Alex Holst Oct 30 '11 at 11:32

1 Answer 1

up vote 1 down vote accepted

You can do this with pam_access module, something like this:

+ : (group1) : ALL
+ : (group2) : 127.0.0.0/24
- : ALL : ALL

Activate this module by adding the following line into /etc/pam.d/sshd:

account     required pam_access.so

Also make sure that you've enabled PAM in /etc/ssh/sshd_config:

UsePAM yes
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.