How to enable compat mode on passwd map in Linux ?

Today we will see an interesting article to see how can we enable the compat mode in Linux.

For this we need to make a change in nsswitch file.

Lets see what to change.

1. Enable compat mode.
Earlier:

[root@ngelinux001 ~]# cat /etc/nsswitch.conf
#
# nsswitch.conf
#
passwd: files ldap
shadow: files ldap
group: files ldap

 

Change it to below:

[root@ngelinux001 ~]# cat /etc/nsswitch.conf
#
# nsswitch.conf
#
passwd: compat
passwd_compat: ldap
shadow: files ldap
group: files ldap

 

2. Restart the services

# systemctl restart nslcd
# systemctl restart nscd

 

3. Do it via one single command

cp -p /etc/nsswitch.conf /tmp/nsswitch.conf.bak
sed -i 's/^passwd:.*/passwd: compat \npasswd_compat: ldap/g' /etc/nsswitch.conf
systemctl restart nslcd ; systemctl restart nscd

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments