arthurdejong / nss-pam-ldapd

NSS and PAM modules for lookups using LDAP
https://arthurdejong.org/nss-pam-ldapd/
GNU Lesser General Public License v2.1
54 stars 42 forks source link

Is it possible to use OU in user's DN to mapping homedir?? #59

Open 3pwang opened 1 year ago

3pwang commented 1 year ago

Hello Everyone. Is there anyway to extract the user's first level of OU from DN?? I'd like to use it for mapping user's homedir(i.e. /home/$ou1/$cn). Thanks anyway!! LINE_P2023616_110415

arthurdejong commented 1 year ago

I don't think there is a way currently to do that. Only attributes that are in the entry are available so unless the entry has a $ou attribute it will not work. If the position in the DN is fixed (e.g. no space differences and the OU value is always 3 characters you might be able to use (but this is really fragile):

map homeDirectory "/home/${dn:21:3}/$cn"