Openldap

如何使用 ldapscripts 中的 ldapmodifyuser 更改值

  • September 12, 2018

我找不到如何使用ldapscripts命令的範例,ldapmodifyuser而且我還不夠熟悉,ldapmodify無法弄清楚。

例如,我如何使用ldapmodifyuser來更改使用者的givenName

這是我的嘗試:

~$ sudo ldapmodifyuser 9928892
# About to modify the following entry :
dn: uid=9928892,ou=Users,dc=thisplace,dc=com
objectClass: inetOrgPerson
objectClass: posixAccount
objectClass: shadowAccount
uid: 9928892
sn: FUJI
givenName: GABUTO
cn: GABUTO FUJISHITA
displayName: GABUTO FUJISHITA
uidNumber: 18055
gidNumber: 5000
gecos: GABUTO FUJISHITA
loginShell: /bin/bash
homeDirectory: /home/9928892
userPassword:: e2NyeXB0fS...
shadowLastChange: 17575

# Enter your modifications here, end with CTRL-D.
dn: uid=9928892,ou=Users,dc=thisplace,dc=com
givenName:GAKUTO      # Ctrl+D
Error modifying user entry uid=9928892,ou=Users,dc=thisplace,dc=com in LDAP

你沒有指定

changetype: modify

replace: givenName

它應該是:

sudo ldapmodifyuser 9928892
# About to modify the following entry :
dn: uid=9928892,ou=Users,dc=thisplace,dc=com
objectClass: inetOrgPerson
objectClass: posixAccount
objectClass: shadowAccount
uid: 9928892
sn: FUJI
givenName: GABUTO
cn: GABUTO FUJISHITA
displayName: GABUTO FUJISHITA
uidNumber: 18055
gidNumber: 5000
gecos: GABUTO FUJISHITA
loginShell: /bin/bash
homeDirectory: /home/9928892
userPassword:: e2NyeXB0fS...
shadowLastChange: 17575

# Enter your modifications here, end with CTRL-D.
dn: uid=9928892,ou=Users,dc=thisplace,dc=com
changetype: modify
replace: givenName
givenName:GAKUTO      # Ctrl+D

引用自:https://unix.stackexchange.com/questions/424011