加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

linux – 无法使用useradd添加用户

发布时间:2020-12-14 02:40:17 所属栏目:Linux 来源:网络整理
导读:尝试将(不存在的)用户添加到我的CentOS系统是返回useradd:用户示例存在.我可以成功地手动将用户添加到/ etc / passwd和/ etc / shadow,但是这种解决方法是A Bad Thing.用户存在于LDAP中,但PAM未使用LDAP进行身份验证.添加其他用户工作正常.我很难过. ETA:
尝试将(不存在的)用户添加到我的CentOS系统是返回useradd:用户示例存在.我可以成功地手动将用户添加到/ etc / passwd和/ etc / shadow,但是这种解决方法是A Bad Thing.用户存在于LDAP中,但PAM未使用LDAP进行身份验证.添加其他用户工作正常.我很难过.

ETA:

[root ~]# userdel example
userdel: error deleting password entry
userdel: error deleting shadow password entry
[root ~]# useradd example
useradd: user example exists
[root ~]# su example
bash-3.2$whoami
example
bash-3.2$groups example
example : Users
bash-3.2$cd
bash: cd: /home/example: No such file or directory
bash-3.2$

解决方法

如果在/etc/nsswitch.conf中包含LDAP(例如passwd:files ldap或passwd:compat passwd_compat:ldap等),则getent passwd就足够了,因此useradd可以查看LDAP条目.

这两个实用程序都与PAM无关,即使PAM对LDAP一无所知,也很乐意识别LDAP条目.

顺便说一句,如果你有nscd运行,请记得在更改nsswitch.conf后重新启动它.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读