Overriding the LDAP Login Shell on Debian and CentOS Clients

override LDAP login shell

* This page contains promotional content

There are cases where, on a particular LDAP client machine, you want to use a different shell rather than the one defined on the LDAP server (bash)

This is possible by configuring the Linux (Debian/CentOS) client to override the shell

Debian11(bullseye)

Add the following to /etc/libnss-ldap.conf
(look up the path to the shell beforehand)

nss_override_attribute_value loginShell /usr/bin/zsh

Flush the nscd cache

# nscd -i passwd nscd

CentOS8

Add the following to /etc/nslcd.conf

map    passwd loginShell    "/usr/bin/zsh"

Restart nslcd

# systemctl restart nslcd

Additional notes

I tend to use zsh on most of my Linux machines, but zsh still is not installed by default when Linux is installed, so it is safer to keep bash as the shell for logging in with LDAP authentication

See also