Quản lý user trong domain bằng ldifde
Posted by dongthao on Tháng Chín 25, 2011
1. Add user vào domain:
Làm file user.txt như sau (MS kêu làm file .ldf nhưng Windows nó có để ý tới đuôi file đâu)
dn: CN=GuyThomas, OU=Finance, DC=Bluevalley, DC=com
changetype: add
#cn: GuyThomas
objectClass: user
samAccountName: Guy
givenName: Guy
sn: Thomas
Lưu ý là bỏ cái field cn ra, không thì sẽ bị báo lỗi
Add error on line 1: Invalid DN Syntax
The server side error is “Multiple values were specified for an attribute that can have only one value.”
Dùng lệnh ldifde để import file vào
ldifde -i -f user.txt
Ngoài ra dùng ldifde để export dữ liệu của Active Directory ra file dạng ldf:
ldifde -f export.ldf
2. Chỉnh sửathuộc tính của user
Để chỉnh sửa thuộc tính user, điểm chính là gán changetype: modify.
dn: CN=Guy Thomas, OU=Birmingham, DC=cp,DC=com
changetype: modify
replace: samAccountName
samAccountName:tom-
Lưu ý có dấu “-” cuối file.
3. Xóa user:
dn: CN=Guy Thomas, OU=Birmingham, DC=cp,DC=com
changetype: modify
