ディレクトリエントリを変更するには、ldapmodify(1) を使用します。ldapmodify は、LDAP ディレクトリサーバーとの接続を開き、そのディレクトリサーバーにバインドして、ディレクトリに対して一連の LDAP 変更処理を実行します。
ディレクトリマネージャ (パスワード enigma) としてバインドし、メールアドレス eng@ultra.com を Joe Qwerty のエントリに追加します。
% ldapmodify -D "cn=Manager, o=Ultra Keyboards Inc., \ c=US" -w enigma < modfile |
modfile の内容は次のとおりです。
dn: cn=carol,ou=People,o=Ultra Keyboards Inc.,c=US changetype: modify replace: userpassword userpassword: {crypt}mgq25KV6CE0p6 - replace: objectclass objectclass: top objectclass: shadowAccount objectclass: account objectclass: posixAccount - add: shadowlastchange shadowlastchange: 6447 - dn: cn=stephen,ou=People,o=Ultra Keyboards Inc.,c=US changetype: modify replace: userpassword userpassword: {crypt}w.4P1JPV3w.Zs - replace: objectclass objectclass: top objectclass: shadowAccount objectclass: account objectclass: posixAccount - add: shadowlastchange shadowlastchange: 6447 - dn: cn=frank,ou=People,o=Ultra Keyboards Inc.,c=US changetype: modify replace: userpassword userpassword: {crypt}mMBEaHRlf5rJQ - replace: objectclass objectclass: top objectclass: shadowAccount objectclass: account objectclass: posixAccount - add: shadowlastchange shadowlastchange: 9712 - |
ハイフンだけの行は、同一ディレクトリエントリに対する一連の変更コマンドを区切ります。空白行は、異なるディレクトリエントリを区切ります。
正常に終了すると、ldapmodify は次のようなメッセージを表示します。
# ldapmodify -D "cn=Directory Manager" -w nssecret -f domain.ldif modifying entry dc=sun,dc=com |
処理が正常に終了しなかった場合は、エラーメッセージが表示されます。