如何正確 ldapmodify 取代 olcAccess 行?

如何正確 ldapmodify 取代 olcAccess 行?

這是 olcDatabase={1}hdb.ldif 的一部分

olcAccess: {0}to attrs=userPassword,shadowLastChange
 by self write
 by anonymous auth
 by dn="cn=admin,dc=somesite,dc=com" write
 by * none
olcAccess: {1}to dn.base="" by * read
olcAccess: {2}to *
 by self write
 by dn="cn=admin,dc=somesite,dc=com" write
 by * read

我想附加by dn="cn=anotheruser,ou=Users,dc=somesite,dc=com" write{0}and{2}行。

在我銷毀我的 LDAP 伺服器之前,以下 LDIF 正確嗎?

dn: olcDatabase{1}hdb,cn=config
changetype: modify
replace: olcAccess
olcAccess: {0}to attrs=userPassword,shadowLastChange
        by dn="cn=admin,dc=somesite,dc=com" write
        by dn="uid=anotheruser,ou=Users,dc=somesite,dc=com" write
        by anonymous auth
        by self write
        by * none
olcAccess: {2}to *
 by self write
 by dn="cn=admin,dc=somesite,dc=com" write
 by dn="cn=anotheruser,ou=Users,dc=somesite,dc=com" write
 by * read

和:ldapmodify -Y EXTERNAL -H ldapi:/// -f ./changes.ldif

我的擔憂是:

  • 有 3olcAccess:行,我沒有包含 {1} 行,所以在提交 ldif 更改後它仍然存在嗎
  • 線路正確嗎replace: olcAccess

答案1

這個 ldif 對我有用,使用之前的指令

dn: olcDatabase{1}hdb,cn=config
changetype: modify
replace: olcAccess
olcAccess: {0}to attrs=userPassword,shadowLastChange
        by dn="cn=admin,dc=somesite,dc=com" write
        by dn="uid=anotheruser,ou=Users,dc=somesite,dc=com" write
        by anonymous auth
        by self write
        by * none
olcAccess: {1}to dn.base="" by * read
olcAccess: {2}to *
 by self write
 by dn="cn=admin,dc=somesite,dc=com" write
 by dn="cn=anotheruser,ou=Users,dc=somesite,dc=com" write
 by * read

相關內容