大网数据广告活动
服务器运维问答

Allow domain group ssh access

· 52CE 我爱测

Centos 7 joined to 2012 R2 AD domain Joined to AD domain with realm join and now I can ssh in as any domain user ( ssh server -l [email omitted] ) I can also login to the local console via [email omitted] as well. I want to only …

问题原文

原帖链接 · red888 · CC BY-SA 3.0

Centos 7 joined to 2012 R2 AD domain

Joined to AD domain with realm join and now I can ssh in as any domain user (ssh server -l [email omitted])

I can also login to the local console via [email omitted] as well.

I want to only allow certain domain groups to ssh in so I added this to the bottom of /etc/ssh/sshd_config:

(serveradmins is an AD security group)

AllowGroups serveradmins

But that doesn't seem to work. Users in the serveradmins group cannot login and I see these messages in /var/log/messages:

I also tried

AllowGroups LAB\serveradmins

I think ssh or something is messing with the password because preauthentication failure errors are usually incorrect password problems (according to microsoft)

I should say I can still login locally as [email omitted] without issues.

Edit: OK so I have achieved what I wanted to accomplish with pam_access by enable the module for sshd and then writing this to access.conf:

+ : (LAB\serveradmins) : ALL
- : ALL : ALL

Seems like pam_access is the way to go as it is more uniform, but I'd still like to know where sshd_config is falling down.

社区高分解答

原帖链接 · KhaiL · CC BY-SA 4.0

After a long search for a solution to this, I finally found it.

If you used "realm join" to join the box into an AD domain, then continue to use the realm command to restrict the group access.

First, remove all group access:

realm deny -a

Then, allow only the groups that should have access:

realm permit -g groupname@domainname

Note, if your group name has a space in it, then you'll need to quote it out:

realm permit -g "group name"@domainname

Hope this helps someone!

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-05-31)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0 / CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。