Recently I've deployed a few raspberry pi nodes running raspbian and I did not want to have local users (except the 'pi' one) but have it using ldap for authentication. So here is what I did to get it working with raspbian 9.
You'll have to start by installing the necessary package in this case, which is libnss-ldapd.
Feel free to comment and / or suggest a topic.
You'll have to start by installing the necessary package in this case, which is libnss-ldapd.
[archy@rpi3 ~]$ sudo apt-get -y install libnss-ldapd
When the installation is complete, we'll need to edit the config. Edit the /etc/nslcd.conf in your favorite editor [archy@rpi3 ~]$ sudo vim /etc/nslcd.conf
uid nslcd # The user which nslcd will run as
gid nslcd # The group which nslcd will run as
uri ldap://ipa01.archyslife.lan # My ldap-servers which are queried
uri ldap://ipa02.archyslife.lan # for authentication requests,
base dc=archyslife,dc=lan # This base will be used for all queries.
Next up is the name service switch file where we'll need to add a few things. Open up the file in your favorite editor and change it like so: passwd: compat ldap
group: compat ldap
shadow: compat ldap
gshadow: files
hosts: files dns mdns4_minimal [NOTFOUND=return] dns
networks: files
protocols: db files
services: db files
ethers: db files
rpc: db files
netgroup: nis
Next, we'll have to configure the pluggable authentication modules (PAM) to also use LDAP-Authentication as auth-source. Run the following command to achieve that: [archy@rpi3 ~]$ sudo pam-auth-update
and then enabling the LDAP Authentication. Last thing to do, is restarting the nslcd and nscd service.and enabling them to start at boot.
[archy@rpi3 ~]$ sudo systemctl restart nslcd.service
[archy@rpi3 ~]$ sudo systemctl restart nscd.service
[archy@rpi3 ~]$ sudo systemctl enable nslcd.service
[archy@rpi3 ~]$ sudo systemctl enable nscd.service
Your Pi is now configured to use ldap authentication. You can test it by running 'su - $ldapuser'.Feel free to comment and / or suggest a topic.
Comments
Post a Comment