首先,创建一个用户组:
groupadd sshuser
vi /etc/pam.d/sshd
auth required pam_sepermit.so
auth include password-auth
account required pam_nologin.so
account include password-auth
password include password-auth
# pam_selinux.so close should be the first session rule
session required pam_selinux.so close
session required pam_loginuid.so
# pam_selinux.so open should only be followed by sessions to be executed in the user context
session required pam_selinux.so open env_params
session required pam_namespace.so
session optional pam_keyinit.so force revoke
session include password-auth
添加:
auth required pam_listfile.so item=group sense=allow file=/etc/security/allow-groups
编辑:
vi /etc/security/allow-groups加入sshuser
上面的配置没有生效,继续找原因。。。。
本文出自 “小V运维之路” 博客,请务必保留此出处http://victor2016.blog.51cto.com/6768693/1901181
原文:http://victor2016.blog.51cto.com/6768693/1901181