简体   繁体   English

禁用Linux用户身份验证(通过ldap除外)

[英]Disable linux user authentication except through ldap

For example I have one user named user1 on my linux server, with password p1 . 例如,我在Linux服务器上有一个名为user1 ,密码为p1 Then I set up a ldap server and add user1 with password p2 . 然后,我设置了一个ldap服务器,并使用密码p2添加了user1。 Turns out now I can login as user1 with both p1 and p2 . 原来,我可以同时使用p1p2作为user1登录。 How can I disable p1 ? 如何禁用p1

passwd -l user

That will lock the user account as you are using LDAP authentication you not need user on server. 这将锁定用户帐户,因为您正在使用LDAP身份验证,而服务器上不需要用户。 And passwd -u user will undo this passwd -u user将撤消此操作

Alternatively, you can accomplish the same thing by prepending a ! 另外,您可以在前面加上!来完成相同的操作! to the user's password in /etc/shadow (this is all passwd -l does behind the scenes). /etc/shadow的用户密码(这是passwd -l在后台执行的所有操作)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM