How does sudo handle environment variables?
AdvancedConceptPermissions, Users & sudo
Answer
By default env_reset gives the command a minimal clean environment and secure_path replaces PATH. That is why sudo mytool can fail with "command not found" when the tool is in /usr/local/bin or your own PATH. Keep specific variables with Defaults env_keep += "http_proxy https_proxy", or pass them explicitly: sudo VAR=value cmd (if allowed) or sudo -E (preserve, if policy permits).
More on Permissions, Users & sudo
Explain the rwx permission model for files and directories.BeginnerHow does octal notation work in chmod?BeginnerWhat does chown do and who can run it?IntermediateWhat is umask and how is the final permission calculated?IntermediateWhat is SUID and give a real example?IntermediateWhat does SGID do on files versus directories?Intermediate