At work I have Ubuntu 16.04 with LDAP account. I have several NOPASSWD rules in /etc/sudoers.d/gbs configured. They are visible:
$ sudo -l Matching Defaults entries for m.lewicki on AMDC1494.digital.local: env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin, timestamp_timeout=120, env_keep+=http_proxy, env_keep+=no_proxy, env_keep+=https_proxy, env_keep+=HTTP_PROXY, env_keep+=HTTPS_PROXY, env_keep+=BUILD_DIR User m.lewicki may run the following commands on AMDC1494.digital.local: (ALL : ALL) ALL (ALL) NOPASSWD: /bin/mount -o bind /*/* */scratch.* (ALL) NOPASSWD: /bin/umount -l */scratch.* (ALL) NOPASSWD: /bin/umount -l -f */scratch.* (ALL) NOPASSWD: /bin/mkdir -p */scratch.* (ALL) NOPASSWD: /usr/bin/build (ALL) NOPASSWD: /bin/cp *.conf */scratch.*/*.conf (ALL) NOPASSWD: /bin/rm -f */.build.log (ALL) NOPASSWD: /bin/echo -n (ALL) NOPASSWD: /usr/sbin/chroot */scratch.* (ALL) NOPASSWD: /usr/bin/chroot */scratch.* (root) NOEXEC: NOPASSWD: /usr/bin/updatedb (ALL) ALL
However they are ginored. For example
$ sudo echo -n
Still asks for password. I tried adding "sudoers: files ldap" to vim /etc/nsswitch.conf and tried apt-get install sudo-ldap, but neither helped.
Local user account that is NOT managed by LDAP works fine and doesn't ask for password for specified commands.
How to make local sudoers file respected?