I have a working LDAP authentication environment. LDAP server is on ubuntu 12.04 machine while client are all centos 6.4 machines. Recently I configure sudoers in LDAP following this article http://www.malaya-digital.org/configure-ldap-for-sudo-support-in-ubuntu-server-11-04-64-bit/
Everything works fine except that the PATH is strange when using sudo to execute command.
Here are the PATH of sudo
# sudo printenv PATH "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
It seems that every commands listed in the PATH shown above can be executed, except which in /bin . For example
# sudo which node /usr/local/bin/node # sudo which zip /usr/bin/zip # sudo which ip /sbin/ip # sudo which ls which: no ls in ("/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin") #WTF?? # sudo ls / sudo: ls: command not found
However, when using full path to execute command in /bin, it works.
# sudo /bin/ls / bin boot dev etc home lib lib64 lost+found media mnt NFS opt proc root sbin selinux srv sys tmp usr var
The LDAP entry with PATH setting is as follow:
dn: cn=defaults,ou=SUDOers,dc=example.dc=com objectClass: top objectClass: sudoRole cn: defaults description: Default sudoOption's go here sudoOrder: 1 sudoOption: env_reset sudoOption: secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"