{"id":5862,"date":"2020-05-09T22:55:44","date_gmt":"2020-05-09T19:55:44","guid":{"rendered":"https:\/\/kifarunix.com\/?p=5862"},"modified":"2024-03-14T20:34:37","modified_gmt":"2024-03-14T17:34:37","slug":"install-and-setup-phpldapadmin-on-ubuntu-20-04","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/install-and-setup-phpldapadmin-on-ubuntu-20-04\/","title":{"rendered":"Install and Setup phpLDAPadmin on Ubuntu 20.04"},"content":{"rendered":"\n<p>In this guide, you will learn how to install and setup phpLDAPadmin on Ubuntu 20.04. <a rel=\"noreferrer noopener\" href=\"http:\/\/phpldapadmin.sourceforge.net\/wiki\/index.php\/About\" target=\"_blank\">phpLDAPadmin<\/a> (also known as PLA) is a web-based application written in PHP for administering LDAP servers. PLA is designed to manage records in an LDAP server, including creating, modifying, deleting records.<\/p>\n\n\n\n<p>Learn how to install and setup OpenLDAP server with SSL\/TLS on Ubuntu 20.04 by following the link below;<\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-and-setup-openldap-server-on-ubuntu-20-04\/\" target=\"_blank\" rel=\"noreferrer noopener\">Install and Setup OpenLDAP Server on Ubuntu 20.04<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Installing phpLDAPadmin on Ubuntu 20.04<\/h2>\n\n\n\n<p>Want to use Debian 10\/11 instead? Check the link below;<\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-phpldapadmin-on-debian-10-debian-11\/\" target=\"_blank\" rel=\"noreferrer noopener\">Install phpLDAPAdmin on Debian 10\/Debian 11<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Install phpLDAPadmin on Ubuntu 20.04<\/h3>\n\n\n\n<p>phpLDAPadmin is available on Ubuntu 20.04 repos;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>apt show phpldapadmin<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>Package: phpldapadmin\nVersion: 1.2.2-6.3\nPriority: extra\nSection: universe\/admin\nOrigin: Ubuntu\nMaintainer: Ubuntu Developers ubuntu-devel-discuss@lists.ubuntu.com\nOriginal-Maintainer: Fabio Tranchitella kobold@debian.org\nBugs: https:\/\/bugs.launchpad.net\/ubuntu\/+filebug\nInstalled-Size: 4,686 kB\nDepends: php, php-ldap, php-xml, ucf (&gt;= 0.28), debconf (&gt;= 0.5) | debconf-2.0\nDownload-Size: 719 kB\nAPT-Sources: http:\/\/us.archive.ubuntu.com\/ubuntu focal\/universe amd64 Packages\n<\/code><\/pre>\n\n\n\n<p>You can simply install it by running the command below;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>apt install phpldapadmin<\/code><\/pre>\n\n\n\n<p>Note that will install phpLDAPadmin with PHP 7.4. So expect a number of warnings on deprecation when running phpLDAPadmin.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Configuring phpLDAPadmin on Ubuntu 20.04<\/h3>\n\n\n\n<p>The default configuration file for phpLDAPadmin is <code><strong>\/etc\/phpldapadmin\/config.php<\/strong><\/code>. This is the file that we are going to edit to make our configuration changes as per LDAP server settings.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>vim \/etc\/phpldapadmin\/config.php<\/code><\/pre>\n\n\n\n<p>The configuration file is highly commented. We are only going to make a few changes in this demo, enough to access and run phpLDAPadmin to administer LDAP server.<\/p>\n\n\n\n<p>Set a suitable name for your LDAP server. This is the name that will appear on phpLDAPadmin web interface.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>\/*********************************************\n * Define your LDAP servers in this section  *\n *********************************************\/\n...\n...\n\/* A convenient name that will appear in the tree viewer and throughout\n   phpLDAPadmin to identify this LDAP server to users. *\/\n$servers-&gt;setValue('server','name','<strong>Kifarunix-demo LDAP Server<\/strong>');\n...<\/code><\/pre>\n\n\n\n<p>Define the IP address or resolvable hostname of your OpenLDAP server;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>$servers-&gt;setValue('server','host','<strong>ldap.kifarunix-demo.com<\/strong>');<\/code><\/pre>\n\n\n\n<p>Define the port on which your OpenLDAP server is listening on. In our demo, our OpenLDAP is configured with StartTLS (port 389).<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>\/* The port your LDAP server listens on (no quotes). 389 is standard. *\/\n<strong>$servers-&gt;setValue('server','port',389);<\/strong><\/code><\/pre>\n\n\n\n<p>Set the OpenLDAP base DN. In our setup, OpenLDAP base DN is set to <strong><code>dc=kifarunix-demo,dc=com<\/code><\/strong>.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>\/* Array of base DNs of your LDAP server. Leave this blank to have phpLDAPadmin\nauto-detect it for you. *\/\n$servers-&gt;setValue('server','base',array('<strong>dc=kifarunix-demo,dc=com<\/strong>'));<\/code><\/pre>\n\n\n\n<p>Define your phpLDAPadmin authentication type. In this demo, we choose the default authentication type, <code>session<\/code>.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>$servers-&gt;setValue('login','auth_type','session');<\/code><\/pre>\n\n\n\n<p>Define the Bind DN of the administrative user to login to phpLDAPadmin;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>$servers-&gt;setValue('login','bind_id','<strong>cn=admin,dc=kifarunix-demo,dc=com<\/strong>');<\/code><\/pre>\n\n\n\n<p>You can optionally specify an attribute to use when logging in. In our case, we want to use full DN, <strong><code>cn=admin,dc=kifarunix-demo,dc=com<\/code><\/strong>, for logging in.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>$servers-&gt;setValue('login','attr','dn');<\/code><\/pre>\n\n\n\n<p>Configure user ID auto increment when creating users from phpLDAPadmin web interface. This ensures that you do not re-use already assigned user and group IDs. In this setup, we choose the ID from 10000.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>\/* The minimum number to use when searching for the next available number\n(only when 'search' is used for auto_number. *\/\n<strong>$servers-&gt;setValue('auto_number','min',array('uidNumber'=&gt;10000,'gidNumber'=&gt;10000));<\/strong><\/code><\/pre>\n\n\n\n<p>That is all the changes we could make in this guide. Go through the configuration file and choose any other option you want to configure.<\/p>\n\n\n\n<p>Save and exit the file once done with configuration.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Configure Apache for phpLDAPadmin<\/h3>\n\n\n\n<p>If you need to make any changes on phpLDAPadmin Apache configuration, edit the file, <code><strong>\/etc\/apache2\/conf-available\/phpldapadmin.conf<\/strong><\/code> and make your changes. We go with the default settings in our case.<\/p>\n\n\n\n<p>Disable Apache default site (with welcome page)<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>a2dissite 000-default.conf<\/code><\/pre>\n\n\n\n<p>Open Apache on firewall to allow external access.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>ufw allow 80\/tcp<\/code><\/pre>\n\n\n\n<p>Restart Apache;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>systemctl restart apache2<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Accessing phpLDAPadmin on Browser<\/h3>\n\n\n\n<p>You can access phpLDAPadmin using the address, <code><strong>http:\/\/server-IP-or-Hostname\/phpldapadmin<\/strong><\/code>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1361\" height=\"495\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/05\/phpldapadmin.png\" alt=\"\" class=\"wp-image-5869\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/05\/phpldapadmin.png?v=1589122396 1361w, https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/05\/phpldapadmin-768x279.png?v=1589122396 768w\" sizes=\"(max-width: 1361px) 100vw, 1361px\" \/><\/figure>\n\n\n\n<p>If you get the warning, <br><em><code><strong>Deprecated<\/strong>: Array and string offset access syntax with curly braces is deprecated in <strong>\/usr\/share\/phpldapadmin\/lib\/functions.php<\/strong> on line <strong>1614<\/strong><\/code><\/em>, you can simply replace the curly braces (<code><strong>{}<\/strong><\/code>) with square brackets (<code>[]<\/code>) on the affected line, 1614.<\/p>\n\n\n\n<p>Click <strong>login<\/strong> to login to you phpLDAPadmin web user interface. Since we already defined the admin Bind DN, simply enter the password and login;<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1365\" height=\"471\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/05\/login-phpldapadmin.png\" alt=\"\" class=\"wp-image-5870\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/05\/login-phpldapadmin.png?v=1589122425 1365w, https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/05\/login-phpldapadmin-768x265.png?v=1589122425 768w\" sizes=\"(max-width: 1365px) 100vw, 1365px\" \/><\/figure>\n\n\n\n<p>Upon successful authentication, you land on phpLDAPadmin dashboard.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1355\" height=\"497\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/05\/phpldapadmin-dashboard.png\" alt=\"\" class=\"wp-image-5871\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/05\/phpldapadmin-dashboard.png?v=1589122446 1355w, https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/05\/phpldapadmin-dashboard-768x282.png?v=1589122446 768w\" sizes=\"(max-width: 1355px) 100vw, 1355px\" \/><\/figure>\n\n\n\n<p>You can now administer your LDAP server with web interface.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"create-ldap-user-phpldapadmin\"><a href=\"#create-ldap-user-phpldapadmin\">Create LDAP User on phpLDAPadmin<\/a><\/h3>\n\n\n\n<p>As an example, we will learn how to create an LDAP user and its group using phpLDAPadmin.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Create user posixGroup<\/h4>\n\n\n\n<p>Click <code>ou=group<\/code>. Then click <code><strong>Create new entry here<\/strong><\/code> {option 1} or click <code><strong>Create a child entry<\/strong><\/code> {option 2}.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1336\" height=\"442\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/05\/create-grp-options.png\" alt=\"\" class=\"wp-image-5872\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/05\/create-grp-options.png?v=1589122481 1336w, https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/05\/create-grp-options-768x254.png?v=1589122481 768w\" sizes=\"(max-width: 1336px) 100vw, 1336px\" \/><\/figure>\n\n\n\n<p>Next, click <code><strong>Generic: Posix Group<\/strong><\/code> template for creating an LDAP user group.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1339\" height=\"513\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/05\/posixgroup.png\" alt=\"\" class=\"wp-image-5873\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/05\/posixgroup.png?v=1589122515 1339w, https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/05\/posixgroup-768x294.png?v=1589122515 768w\" sizes=\"(max-width: 1339px) 100vw, 1339px\" \/><\/figure>\n\n\n\n<p>Enter name of the group, which in this case we set it to be same as the uid of the user we are going to create. <strong>If you noticed, the group is autopopulated<\/strong>.<\/p>\n\n\n\n<p>If you want any other users to be part of the group, select their usernames. Click <strong><code>Create Object <\/code><\/strong>once done and commit the changes.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1329\" height=\"594\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/05\/group-added.png\" alt=\"\" class=\"wp-image-5874\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/05\/group-added.png?v=1589122542 1329w, https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/05\/group-added-768x343.png?v=1589122542 768w\" sizes=\"(max-width: 1329px) 100vw, 1329px\" \/><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\">Create user posixAccount<\/h4>\n\n\n\n<p>Once you have a user group created, proceed to create the user account. Click on <code><strong>ou=people<\/strong><\/code> and similarly, you have two options, either click <code><strong>Create new entry here<\/strong><\/code> or click <code><strong>Create a child entry<\/strong><\/code>.<\/p>\n\n\n\n<p>Select the <code><strong>Generic: User Account<\/strong><\/code> template for creating user object.<\/p>\n\n\n\n<p>Generate user password hash;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>slappasswd<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>New password: <strong>password<\/strong>\nRe-enter new password: <strong>password<\/strong>\n<strong>{SSHA}vrJOf+\/AFD9pdGKo\/azGavDfbZ8OGJX1<\/strong><\/code><\/pre>\n\n\n\n<p>If you need to verify if the password matches the pasted hash, click <strong>check password<\/strong>.<\/p>\n\n\n\n<p>When you set the password, select <strong>ssha<\/strong> and paste the hash above as the password.<\/p>\n\n\n\n<p>Fill in the user details appropriately as shown in the screenshot below;<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1102\" height=\"626\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/05\/user-object.png\" alt=\"\" class=\"wp-image-5875\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/05\/user-object.png?v=1589122678 1102w, https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/05\/user-object-768x436.png?v=1589122678 768w\" sizes=\"(max-width: 1102px) 100vw, 1102px\" \/><\/figure>\n\n\n\n<p>Once done, click <strong><code>Create Object <\/code><\/strong>once done and commit the changes.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1275\" height=\"598\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/05\/ldap-user.png\" alt=\"\" class=\"wp-image-5876\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/05\/ldap-user.png?v=1589122708 1275w, https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/05\/ldap-user-768x360.png?v=1589122708 768w\" sizes=\"(max-width: 1275px) 100vw, 1275px\" \/><\/figure>\n\n\n\n<p>Note, to be able to have bash among the shell options, edit the posixAccount creation template and add bash option by running the command;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sed -i '\/&lt;value id=\"\\\/bin\\\/tsh\"&gt;\\\/bin\\\/tsh&lt;\\\/value&gt;\/a \\\\t&lt;value id=\"\/bin\/bash\"&gt;\\\/bin\\\/bash&lt;\\\/value&gt;' \/etc\/phpldapadmin\/templates\/creation\/posixAccount.xml<\/code><\/pre>\n\n\n\n<p>If you have the user information in an LDIF file, you can import this file by clicking <strong>import<\/strong> at the top menu bar on the left pane.<\/p>\n\n\n\n<p>To confirm the user creation on OpenLDAP server backend;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>ldapsearch -H ldapi:\/\/\/ -Y EXTERNAL -b \"dc=kifarunix-demo,dc=com\" \"(&amp;(objectclass=posixAccount)(uid=janedoe))\" -LLL -Q<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>dn: cn=janedoe,ou=people,dc=kifarunix-demo,dc=com\ncn: janedoe\ngivenName: Jane\ngidNumber: 10001\nhomeDirectory: \/home\/janedoe\nsn: Doe\nloginShell: \/bin\/bash\nobjectClass: inetOrgPerson\nobjectClass: posixAccount\nobjectClass: top\nuidNumber: 10001\nuid: janedoe\nuserPassword:: e1NTSEF9Y1VNNWx1UWM0Sjl5WlhnZWJZTHkwMjRhTmszdlVkUE4=\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>ldapsearch -H ldapi:\/\/\/ -Y EXTERNAL -b \"dc=kifarunix-demo,dc=com\" \"(&amp;(objectclass=posixGroup)(cn=janedoe))\" -LLL -Q<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>dn: cn=janedoe,ou=groups,dc=kifarunix-demo,dc=com\ngidNumber: 10001\ncn: janedoe\nobjectClass: posixGroup\nobjectClass: top<\/code><\/pre>\n\n\n\n<p>You can explore the functionality of this tool further.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Related Tutorials<\/h3>\n\n\n\n<p><a rel=\"noreferrer noopener\" href=\"https:\/\/kifarunix.com\/install-phpldapadmin-on-centos-8\/\" target=\"_blank\">Install phpLDAPadmin on CentOS 8<\/a><\/p>\n\n\n\n<p><a rel=\"noreferrer noopener\" href=\"https:\/\/kifarunix.com\/configure-sssd-for-ldap-authentication-on-ubuntu-20-04\/\" target=\"_blank\">Configure SSSD for LDAP Authentication on Ubuntu 20.04<\/a><\/p>\n\n\n\n<p><a rel=\"noreferrer noopener\" href=\"https:\/\/kifarunix.com\/setup-openldap-master-slave-replication-on-centos-8\/\" target=\"_blank\">Setup OpenLDAP Master-Slave Replication on CentOS 8<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/how-to-configure-dokuwiki-openldap-authentication\/\" target=\"_blank\" rel=\"noreferrer noopener\">How to Configure DokuWiki OpenLDAP Authentication<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this guide, you will learn how to install and setup phpLDAPadmin on Ubuntu 20.04. phpLDAPadmin (also known as PLA) is a web-based application written<\/p>\n","protected":false},"author":3,"featured_media":9240,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"footnotes":""},"categories":[121,285,1099],"tags":[1594,1592,1591,1593,1200],"class_list":["post-5862","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-howtos","category-directory-server","category-openldap","tag-install-phpldapadmin-on-ubuntu","tag-install-phpldapadmin-on-ubuntu-20-04","tag-phpldapadmin","tag-phpldapadmin-ubuntu-20-04","tag-ubuntu-20-04","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-50","resize-featured-image"],"_links":{"self":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/5862"}],"collection":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/comments?post=5862"}],"version-history":[{"count":9,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/5862\/revisions"}],"predecessor-version":[{"id":21386,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/5862\/revisions\/21386"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media\/9240"}],"wp:attachment":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media?parent=5862"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/categories?post=5862"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/tags?post=5862"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}