{"id":972,"date":"2011-02-07T13:28:05","date_gmt":"2011-02-07T13:28:05","guid":{"rendered":"https:\/\/supportex.net\/?p=972"},"modified":"2019-05-11T05:38:49","modified_gmt":"2019-05-11T03:38:49","slug":"backup-restore-ldap-database","status":"publish","type":"post","link":"https:\/\/supportex.net\/blog\/2011\/02\/backup-restore-ldap-database\/","title":{"rendered":"How to backup and restore your LDAP database"},"content":{"rendered":"<p><strong>LDAP<\/strong> is Lightweight Directory Access Protocol. It is a way to communicate with directory services. And for many years it has proved its reliability to organize and keep various type of information, for instance, user accounts. It&#8217;s useful if you want to provide one credentials for accessing to different resources \u2013 servers, web pages, etc.<br \/>\n<a href=\"http:\/\/www.openldap.org\/\">OpenLDAP<\/a> is open source implementation of the LDAP.<br \/>\nOnce LDAP server is set and running you need to take care about backups.<br \/>\nIf your LDAP backend is one of <em>bdb<\/em>, <em>hdb<\/em> or <em>null<\/em> you can use <strong>slapcat<\/strong>. \u00a0To check it see \/etc\/ldap\/slapd.conf.<br \/>\nHere is an example:<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">debian:~# \/usr\/sbin\/slapcat -v  -l \/home\/backup\/ldap.diff<\/code><\/p>\n<p>Full backup script:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">#!\/bin\/sh\nLDAPBK=ldap-$( date +%y%m%d-%H%M ).ldif\nBACKUPDIR=\/home\/backups\n&amp;lt;pre&amp;gt;\/usr\/sbin\/slapcat -v -b \"dc=yourDC,dc=local\" -l $BACKUPDIR\/$LDAPBK\ngzip -9 $BACKUPDIR\/$LDAPBK\n<\/pre>\n<p>You should just change LDAP suffix from &#8220;dc=yourDC,dc=local&#8221; to your actual one.<\/p>\n<p>To <strong>restore<\/strong> you should perform the following steps.<\/p>\n<p>1. \u00a0stop <strong>slapd<\/strong> daemon:<br \/>\n<code class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">debian:~# \/etc\/init.d\/slapd stop<\/code><br \/>\n2. delete old database (<strong>make sure you are in right directory to use rm<\/strong>):<br \/>\n<code><code class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">debian:~# cd \/var\/lib\/ldap<\/code><br \/>\n<code class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">rm -rf *<\/code><\/code><br \/>\n2. Restore database from LDIF file:<br \/>\n<code class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">debian:~# \/usr\/sbin\/slapadd -l backup.ldif<\/code><\/p>\n<p>4. run <strong>slapd<\/strong> daemon:<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">debian:~# \/etc\/init.d\/slapd start<\/code><\/p>\n<p><strong>Didn&#8217;t find the answer to your question? <a href=\"\/contacts\/\">Ask it<\/a> our administrators to reply we will publish on website.<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>LDAP is Lightweight Directory Access Protocol. It is a way to communicate with directory services. And for many years it has proved its reliability to organize and keep various type of information, for instance, user accounts. It&#8217;s useful if you want to provide one credentials for accessing to different resources \u2013 servers, web pages, etc.&hellip; <\/p>\n<div class=\"readmore-wrapper\"><a href=\"https:\/\/supportex.net\/blog\/2011\/02\/backup-restore-ldap-database\/\" class=\"more-link\">Read <\/a><\/div>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[152],"tags":[204,275,205],"class_list":["post-972","post","type-post","status-publish","format-standard","hentry","category-linux","tag-ldap-en","tag-linux","tag-slapd-en"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to backup and restore your LDAP database &#8211; Supportex.NET blog<\/title>\n<meta name=\"description\" content=\"How to backup and restore your LDAP database\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/supportex.net\/blog\/2011\/02\/backup-restore-ldap-database\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to backup and restore your LDAP database &#8211; Supportex.NET blog\" \/>\n<meta property=\"og:description\" content=\"How to backup and restore your LDAP database\" \/>\n<meta property=\"og:url\" content=\"https:\/\/supportex.net\/blog\/2011\/02\/backup-restore-ldap-database\/\" \/>\n<meta property=\"og:site_name\" content=\"Supportex.NET blog\" \/>\n<meta property=\"article:published_time\" content=\"2011-02-07T13:28:05+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-05-11T03:38:49+00:00\" \/>\n<meta name=\"author\" content=\"Oleksii Tykhonov\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Oleksii Tykhonov\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/supportex.net\/blog\/2011\/02\/backup-restore-ldap-database\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/supportex.net\/blog\/2011\/02\/backup-restore-ldap-database\/\"},\"author\":{\"name\":\"Oleksii Tykhonov\",\"@id\":\"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/0690c26a0266603129fc15eae6243251\"},\"headline\":\"How to backup and restore your LDAP database\",\"datePublished\":\"2011-02-07T13:28:05+00:00\",\"dateModified\":\"2019-05-11T03:38:49+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/supportex.net\/blog\/2011\/02\/backup-restore-ldap-database\/\"},\"wordCount\":181,\"commentCount\":0,\"keywords\":[\"ldap\",\"linux\",\"slapd\"],\"articleSection\":[\"linux\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/supportex.net\/blog\/2011\/02\/backup-restore-ldap-database\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/supportex.net\/blog\/2011\/02\/backup-restore-ldap-database\/\",\"url\":\"https:\/\/supportex.net\/blog\/2011\/02\/backup-restore-ldap-database\/\",\"name\":\"How to backup and restore your LDAP database &#8211; Supportex.NET blog\",\"isPartOf\":{\"@id\":\"https:\/\/supportex.net\/blog\/en\/#website\"},\"datePublished\":\"2011-02-07T13:28:05+00:00\",\"dateModified\":\"2019-05-11T03:38:49+00:00\",\"author\":{\"@id\":\"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/0690c26a0266603129fc15eae6243251\"},\"description\":\"How to backup and restore your LDAP database\",\"breadcrumb\":{\"@id\":\"https:\/\/supportex.net\/blog\/2011\/02\/backup-restore-ldap-database\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/supportex.net\/blog\/2011\/02\/backup-restore-ldap-database\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/supportex.net\/blog\/2011\/02\/backup-restore-ldap-database\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/supportex.net\/blog\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to backup and restore your LDAP database\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/supportex.net\/blog\/en\/#website\",\"url\":\"https:\/\/supportex.net\/blog\/en\/\",\"name\":\"Supportex.NET blog\",\"description\":\"Server and network management company\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/supportex.net\/blog\/en\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/0690c26a0266603129fc15eae6243251\",\"name\":\"Oleksii Tykhonov\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/4fd5f58002717075c88963469b9babef?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/4fd5f58002717075c88963469b9babef?s=96&d=mm&r=g\",\"caption\":\"Oleksii Tykhonov\"},\"url\":\"https:\/\/supportex.net\/blog\/author\/oleksiitykhonov\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to backup and restore your LDAP database &#8211; Supportex.NET blog","description":"How to backup and restore your LDAP database","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/supportex.net\/blog\/2011\/02\/backup-restore-ldap-database\/","og_locale":"en_US","og_type":"article","og_title":"How to backup and restore your LDAP database &#8211; Supportex.NET blog","og_description":"How to backup and restore your LDAP database","og_url":"https:\/\/supportex.net\/blog\/2011\/02\/backup-restore-ldap-database\/","og_site_name":"Supportex.NET blog","article_published_time":"2011-02-07T13:28:05+00:00","article_modified_time":"2019-05-11T03:38:49+00:00","author":"Oleksii Tykhonov","twitter_misc":{"Written by":"Oleksii Tykhonov","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/supportex.net\/blog\/2011\/02\/backup-restore-ldap-database\/#article","isPartOf":{"@id":"https:\/\/supportex.net\/blog\/2011\/02\/backup-restore-ldap-database\/"},"author":{"name":"Oleksii Tykhonov","@id":"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/0690c26a0266603129fc15eae6243251"},"headline":"How to backup and restore your LDAP database","datePublished":"2011-02-07T13:28:05+00:00","dateModified":"2019-05-11T03:38:49+00:00","mainEntityOfPage":{"@id":"https:\/\/supportex.net\/blog\/2011\/02\/backup-restore-ldap-database\/"},"wordCount":181,"commentCount":0,"keywords":["ldap","linux","slapd"],"articleSection":["linux"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/supportex.net\/blog\/2011\/02\/backup-restore-ldap-database\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/supportex.net\/blog\/2011\/02\/backup-restore-ldap-database\/","url":"https:\/\/supportex.net\/blog\/2011\/02\/backup-restore-ldap-database\/","name":"How to backup and restore your LDAP database &#8211; Supportex.NET blog","isPartOf":{"@id":"https:\/\/supportex.net\/blog\/en\/#website"},"datePublished":"2011-02-07T13:28:05+00:00","dateModified":"2019-05-11T03:38:49+00:00","author":{"@id":"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/0690c26a0266603129fc15eae6243251"},"description":"How to backup and restore your LDAP database","breadcrumb":{"@id":"https:\/\/supportex.net\/blog\/2011\/02\/backup-restore-ldap-database\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/supportex.net\/blog\/2011\/02\/backup-restore-ldap-database\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/supportex.net\/blog\/2011\/02\/backup-restore-ldap-database\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/supportex.net\/blog\/en\/"},{"@type":"ListItem","position":2,"name":"How to backup and restore your LDAP database"}]},{"@type":"WebSite","@id":"https:\/\/supportex.net\/blog\/en\/#website","url":"https:\/\/supportex.net\/blog\/en\/","name":"Supportex.NET blog","description":"Server and network management company","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/supportex.net\/blog\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/0690c26a0266603129fc15eae6243251","name":"Oleksii Tykhonov","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/4fd5f58002717075c88963469b9babef?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4fd5f58002717075c88963469b9babef?s=96&d=mm&r=g","caption":"Oleksii Tykhonov"},"url":"https:\/\/supportex.net\/blog\/author\/oleksiitykhonov\/"}]}},"_links":{"self":[{"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/posts\/972","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/comments?post=972"}],"version-history":[{"count":2,"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/posts\/972\/revisions"}],"predecessor-version":[{"id":3246,"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/posts\/972\/revisions\/3246"}],"wp:attachment":[{"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/media?parent=972"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/categories?post=972"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/tags?post=972"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}