LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-10-2013, 04:26 AM   #1
newphoenixlinux
LQ Newbie
 
Registered: Feb 2013
Posts: 9

Rep: Reputation: Disabled
Creating an LDIF File


Hello,

I am setting up OpenLDAP and am using the instructions located here:

https://help.ubuntu.com/12.10/server...ap-server.html

One of the steps Modifying/Populating your Database says to:

Create the following LDIF file and call it add_content.ldif:

Is there a specific way to create it? Do you just go in and create a file using the TOUCH command and name it add_content.ldif and modify it with the data that goes into it? Or is there a specific program you should use to create the LDIF file.

Just want to make sure I do it correctly.
 
Old 03-10-2013, 04:40 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387
Ldif files are ordinary text files and you can use any text editor (vi, emacs and gedit are 3, there are many more) to create them.

There are programs available that are ldap specific and you can also use those to create ldif files, but I would keep it simple for now and use a normal text editor.
 
Old 03-10-2013, 05:56 AM   #3
newphoenixlinux
LQ Newbie
 
Registered: Feb 2013
Posts: 9

Original Poster
Rep: Reputation: Disabled
Populating an LDIF File

Hello,
I am following the guide https://help.ubuntu.com/12.10/server...ap-server.html for installing and setting up OpenLDAP and wanted to get clarification on something in the section titled:

Modifying/Populating your Database

In the first part I pasted below it says:

Let's introduce some content to our database. We will add the following:

a node called People (to store users)

a node called Groups (to store groups)

a group called miners

a user called john

Create the following LDIF file and call it add_content.ldif:

dn: ou=People,dc=example,dc=com
objectClass: organizationalUnit
ou: People

dn: ou=Groups,dc=example,dc=com
objectClass: organizationalUnit
ou: Groups

dn: cn=miners,ou=Groups,dc=example,dc=com
objectClass: posixGroup
cn: miners
gidNumber: 5000

dn: uid=john,ou=People,dc=example,dc=com
objectClass: inetOrgPerson
objectClass: posixAccount
objectClass: shadowAccount
uid: john
sn: Doe
givenName: John
cn: John Doe
displayName: John Doe
uidNumber: 10000
gidNumber: 5000
userPassword: johnldap
gecos: John Doe
loginShell: /bin/bash
homeDirectory: /home/john

It's important that uid and gid values in your directory do not collide with local values. Use high number ranges, such as starting at 5000. By setting the uid and gid values in ldap high, you also allow for easier control of what can be done with a local user vs a ldap one. More on that later.

Add the content:

ldapadd -x -D cn=admin,dc=example,dc=com -W -f add_content.ldif

Enter LDAP Password: ********
adding new entry "ou=People,dc=example,dc=com"

adding new entry "ou=Groups,dc=example,dc=com"

adding new entry "cn=miners,ou=Groups,dc=example,dc=com"

adding new entry "uid=john,ou=People,dc=example,dc=com"

My question is, the first part that I have bolded and underlined says to create the file add_content.ldif and then shows a bunch of info, then the next part that I have bolded and underlined says add the content. Am I suppose to add the info from the first area in or the info from the second area into the add_content.ldif or do both sections get added into the one file. Or do you create 2 different files.

Just confused me
 
Old 03-10-2013, 06:10 AM   #4
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387
The first part creates a file that is used by ldapadd (the second part).

Using an input file (add_content.ldif in this case) when executing ldapadd makes life easier. ldapadd doesn't need an input file (you can enter all the entries by hand if you want/need to), but unless you are adding one specific entry I would advise against that.

In short:
- Create add_content.ldif as shown using a text editor,
- Execute the ldapadd command shown (which uses add_content.ldif).

PS: Do have a look at the manual pages.
 
Old 03-10-2013, 06:36 AM   #5
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
Moderator note: two different threads on the same topic have been merged here.
 
Old 03-10-2013, 07:15 AM   #6
newphoenixlinux
LQ Newbie
 
Registered: Feb 2013
Posts: 9

Original Poster
Rep: Reputation: Disabled
sounds good thanks for helping me with that. Also when the add_content.ldif is created where should it be saved to?
 
Old 03-10-2013, 07:51 AM   #7
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387
Quote:
Originally Posted by newphoenixlinux View Post
Also when the add_content.ldif is created where should it be saved to?
You can store them wherever you want.

If you do want to keep these files I would suggest creating a separate directory (example name: ldifs) and store them there. Especially when you are new to this it might be a good idea to keep these ldif files around.

If you get more familiar with ldap you will notice that you do not need these files once you used them (there are possible exceptions, but lets not go into those right now).
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
AWK: convert LDIF file Help Help Help !!!!!!!! haydar68 Programming 15 04-18-2013 01:19 PM
Creating an LDIF File newphoenixlinux Linux - Newbie 1 03-10-2013 04:40 AM
LDIF file in OpenLDAP bkcreddy17 Linux - Newbie 2 01-15-2009 07:36 AM
Problem ldif file for ldap finsh Linux - Server 5 01-15-2008 12:16 PM
openldap ldif file problem iluvatar Linux - Software 3 07-31-2005 07:57 PM


All times are GMT -5. The time now is 04:55 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration