[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: PATH di sudo



Alberto <fi3rizi0@gmail.com> writes:

> infatti per root funziona, il problema è proprio sudo
>
> # env | grep PATH
> PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/schily/bin
>
> $ sudo env  | grep PATH
> PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin

perché così non carichi l'environment di root, prova con 

$ sudo su -
# env | grep PATH

e vedi il path corretto.

> # head sudoers
> Defaults        env_keep += "PATH"
> Defaults        env_reset

Provato con 

Defaults        env_reset
Defaults        env_keep += "PATH"

potrebbe essere che il path venga cancellato visto che env_reset:

env_reset       If set, sudo will reset the environment to only contain
                the LOGNAME, SHELL, USER, USERNAME and the SUDO_*
                variables.  Any variables in the caller's environment
                that match the env_keep and env_check lists are then
                added.  The default contents of the env_keep and
                env_check lists are displayed when sudo is run by root
                with the -V option.  If sudo was compiled with the
                SECURE_PATH option, its value will be used for the PATH
                environment variable.  This flag is on by default.

Ciao, Micky
-- 
UNIX is basically a simple operating system, but you have to 
be a genius to understand the simplicity.  -- Dennis Ritchie


Reply to: