Populating the Directory with User Data--Sample Session

Alpha Corporation is setting up a pilot test of the directory with two users on a lab machine called testserver. The test machine uses NIS+, and has the following users defined:

 
jdoe:fWFuXyZ1S..Vk:1001:10:John Doe:/export/home/jdoe:/bin/sh
 
gevert:fWFuXyZ1S..Vk:1002:10:Gail Evert:/export/home/gevert:/bin/sh
 

To create directory entries for these users, complete the following steps:

  1. Log in as root.

 
$ su
 
Password: <Enter your root password>
 
#
 

  2. Use the getent command to save the user entries in a file:

 
# getent passwd > /tmp/passwd
 

  3. Use the niscat command to extract user information from the mail aliases file, and use the sed command to format the data:

 
# niscat mail.aliases > /tmp/aliases.tmp
 
# sed 's/ /: /' /tmp/aliases.tmp > /tmp/aliases
 


Note - Refer to the Release Notes for details on the formatting rules for the aliases and passwd files.
  4. Change directories to the location shown and edit the imldifsync.conf file.

 
# cd /etc/opt/SUNWmail/dir_svc
 
# vi imldifsync.conf
 

  5. Change the mail-server, passwd-file, and aliases-file values and uncomment the mode = users line as shown:

 
mail-server = "<mailserverhostname>.<fully qualified domain name>"
 
passwd-file = "/tmp/passwd"
 
aliases-file = "/tmp/aliases"
 
mode = users
 

  In the above example, your mail-server can be testserver.eng.alpha.com., where testserver is the hostname of the SIMS 3.2 mail server.
  6. Copy the imldifsync.conf files to users.conf.

 
# cp imldifsync.conf users.conf
 

  7. If you want to set a user mail store quota edit users.conf.
  The SIMS default setting is "no limit." To set a space limit, modify the mailQuota attribute as follows:

 
add-val = { "mailQuota: <quota in bytes>" , "mailFolderMap: SUN-MS" }
 

  where <quota in bytes> would be 10000000 if you wanted to set a mail space quota of 10 megabytes. See "Message Store Quota Enforcement" on page 148 for detailed information on setting quotas.
  8. Change directories to the location shown and convert the user data to LDIF format.
  Use the imldifsync command to generate formatted user data files (LDIF files).

 
# /opt/SUNWmail/sbin/imldifsync -c users.conf > /tmp/users.ldif
 

  You will see the following results on the screen:

 
==================Statistics========================
 

 
Added DNs: 2
 
Modified DNs: 0
 
Delete DNs:   0
 

 
====================================================
 


Note - By default, the mail folder will be set to the Sun Message Store.

The file users.ldif contains the following:

CODE  EXAMPLE  C-1 Contents of the users.ldif File (1 of 2)
 

 
dn: cn="John Doe (jdoe)",ou=People,o=Alpha,c=US
 
 
changetype: add
 
 
cn: John Doe (jdoe)
 
 
cn: John Doe
 
 
sn: Doe
 
 
initials: JD
 
 
givenName: John
 
 
freeFormName: John Doe
 
 
preferredRfc822Originator: john.doe@Engineering
 
 
preferredRfc822Recipient: jdoe@testserver.Alpha.com
 
 
rfc822Mailbox: john.doe@testserver.Alpha.COM
 
 
rfc822Mailbox: jdoe@testserver.Alpha.com
 
 
rfc822Mailbox: jdoe@testserver.Alpha.COM
 
 
rfc822Mailbox: john.doe@Engineering.Alpha.com
 
 
mailDeliveryOption: mailbox
 
 
mailHost: testserver.Alpha.com
 
 
userPassword: {crypt}fWFuXyZ1S..Vk
 
 
uid: jdoe
 
 
homeDirectory: /export/home/jdoe
 
 
dataSource: imldifsync 1.0
 
 
objectClass: top
 
 
objectClass: inetOrgPerson
 
 
objectClass: organizationalPerson
 
 
objectClass: emailPerson
 
 
objectClass: person
 
 
mailQuota: -1
 
 
mailFolderMap: SUN-MS
 
 

 
 
dn: cn="Gail Evert (gevert)",ou=People,o=Alpha,c=US
 
 
changetype: add
 
 
cn: Gail Evert (gevert)
 
 
cn: Gail Evert
 
 
sn: Evert
 
 
initials: GE
 
 
givenName: Gail
 
 
freeFormName: Gail Evert
 
 
preferredRfc822Originator: gail.evert@Engineering
 
 
mailForwardingAddress: gail.evert@testserver.Alpha.COM
 
 
mailDeliveryOption: mailbox
 
 
userPassword: {crypt}fWFuXyZ1S..Vk
 
 
uid: gevert
 
 
homeDirectory: /export/home/gevert
 
 
dataSource: imldifsync 1.0
 
 
objectClass: top
 
 
objectClass: inetOrgPerson
 
 
objectClass: organizationalPerson
 
 
objectClass: emailPerson
 
 
objectClass: person
 
 
mailQuota: -1
 
 
mailFolderMap: SUN-MS
 

  9. Change directories to the location shown and populate the directory with the user LDIF formatted data.
  Use the ldapmodify command to add the new entries to the directory:

 
# cd /opt/SUNWconn/bin
 
# ldapmodify -D "cn=admin,o=Alpha,c=us" -w secret -f /tmp/users.ldif
 

  You will see the following output on the screen:

 
adding new entry cn="John Doe (jdoe)",ou=People,o=Alpha,c=US
 
adding new entry cn="Gail Evert (gevert)",ou=People,o=Alpha,c=US
 

  10. Verify that the entries are present in the directory, using the ldapsearch command.

CODE  EXAMPLE  C-2 Results of the ldapsearch Command for User Data
 

 
# ldapsearch -L -b "o=Alpha,c=us" "cn=*" cn
 
 
dn: CN=John Doe (jdoe),OU=People,O=Alpha,C=US
 
 
cn: John Doe (jdoe)
 
 
cn: John Doe
 
 
dn: CN=Gail Evert (gevert),OU=People,O=Alpha,C=US
 
 
cn: Gail Evert (gevert)
 
 
cn: Gail Evert
 




Copyright © 1999 Sun Microsystems, Inc. All Rights Reserved.