Global environment variables are not global in sudo shell

Bug #162837 reported by Olivier Blanc
8
Affects Status Importance Assigned to Milestone
sudo (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Since the upgrade to "sudo 1.6.9p6-1ubuntu1 ", the global environment variables are not passed as global variables to sudo shell

For exemple,
export http_proxy=http://foo.bar:8080/ && sudo echo $http_proxy && sudo printenv
returns

http://foo.bar:8080 => for echo

and returns for printenv

TERM=xterm
LANG=fr_FR.UTF-8
DISPLAY=:0.0
COLORTERM=gnome-terminal
XAUTHORITY=/home/olivier/.Xauthority
HOME=/home/olivier
SHELL=/bin/bash
LOGNAME=root
USER=root
USERNAME=root
SUDO_COMMAND=/usr/bin/printenv
SUDO_USER=olivier
SUDO_UID=507
SUDO_GID=501

No reference to http_proxy variable.

Revision history for this message
Gianfranco Liporace (dr.kabuto) wrote :

Hi,
I can confirm this behaviour with Hardy Alpha 4.
I've an application that uses java and test for a variable named "JAVA_HOME". Setting it in /etc/profile or manually using a export statement, the variable is not preserved using sudo. With Gutsy all is fine.

Revision history for this message
Gianfranco Liporace (dr.kabuto) wrote :

This bug seems a duplicate of #181999

Revision history for this message
kongyuzhong (kongyuzhong) wrote :

I think the default of env_reset be enable.
maybe need to disable "env_reset" or set "env_keep=" by modified the "/etc/sudoers"

Revision history for this message
Martin Pitt (pitti) wrote :

This is fixed in current hardy's sudo version. http_proxy is passed on every time, and other variables can be kept with "sudo -E".

Changed in sudo:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.