Red Hat Bugzilla – Bug 479078
printenv has different output between sudo versions
Last modified: 2009-01-12 04:06:09 EST
Description of problem:
sudo printenv command returns different output in old and new version of sudo.
Version-Release number of selected component (if applicable):
# rpm -q sudo
# rpm -q sudo
Steps to Reproduce:
1. eg. #sudo printenv PATH
content of $PATH variable such as /usr/lib/qt-3.3/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
I old version I get content of $PATH variable, but in new version I get "Actual results" above. I don't know if it's feature or bug.
Seems it is a feature. In the /etc/sudoers exists two options : env_reset and env_keep.
Defaults env_keep = "COLORS DISPLAY EDITOR HOSTNAME HISTSIZE INPUTRC KDEDIR \
LESSOPEN LS_COLORS MAIL PS1 PS2 QTDIR SSH_ASKPASS
LANG LC_ADDRESS LC_CTYPE LC_COLLATE LC_IDENTIFICATION \
LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC
LC_PAPER LC_TELEPHONE LC_TIME LC_ALL LANGUAGE LINGUAS \
While PATH is not mentioned in env_keep then PATH is reset and gets default path /usr/bin:/bin. So for proper behaviour I need place PATH word into env_keep. In the old version were default setup TERM and PATH as preserve environment value. In the new version this were removed so you need setup it manually.