This is because the operating system resets the environment so that it only contains the LOGNAME, SHELL, USER, USERNAME, and SUDO_ variables by default. As a result, EGO_CONFDIR is not set in the sudo environment.Add the following line to the top of the /etc/sudoers file to preserve all the user environment variables when using "sudo":