vi /etc/ssh/sshd_config 修改 PermitRootLogin yes 添加 AllowUser root vi /etc/security/access.conf 添加 + : ALL : ALL vi /etc/sshd_userlist 查看 auth required pam_listfile.so item=user sense=allow file=/etc/sshd_userlist onerr=succeed vi /etc/sshd_userlist 添加用户名root 完 ============================================================================== pam_listfile.so以实现这样的限制。 首先,创建一个用户列表文件。文件中的每一行是一个用户。假设文件是/etc/sshd_userlist,将允许登录的用户加入到文件中: redhat root user1 然后修改文件权限为600,属主是root: chmod 600 /etc/sshd_userlist chown root /etc/sshd_userlist 接下来修改/etc/pam.d/sshd,将以下一行加入到auth部分: auth required pam_listfile.so item=user sense=allow file=/etc/sshd_userlist onerr=succeed 现在,只有用户redhat,root和user1被允许通过sshd登录。 不在/etc/sshd_userlist中的用户试图通过sshd登录时,系统会记录类似下面的日志信息: Jan 25 14:23:47 dhcp-0-092 sshd[828]: pam_listfile(sshd:auth): Refused user alice for service sshd 请参考/usr/share/doc/pam-version-[version]/txts/README.pam_listfile 以获得更多关于pam_listfile.so的信息。
pam_listfile(sshd:auth):Refused user root for service sshd
精选 转载文章标签 pam_listfile.so以实现这样 文章分类 运维
-
pam_listfile的使用(五)
pam_listfile的使用说明:pam_listfile 应用程序对文件的访问控制[root@station203 pam.d]#
职场 休闲 pam_listfile的使用(五) -
SSH登录报pam_unix(sshd:auth): authentication failure的案例
修改一台Linux服务器(RHEL 6.6)的root密码后,然后使用ssh验证测试时,`
unix 服务器 sed linux linux服务器 -
Linux PAM configuration that allows or deny login via the sshd server
A note for new sys adminsThis PAM module authenticates users based on the contents of a specified file. For example, if username exists in a file /etc/sshd/ssh.allow, sshd will grant login access.Open
Linux server security is simple