Bug 667752

Summary: sudo modifies HOME, breaks past behavior
Product: [Fedora] Fedora Reporter: Daris A Nevil <dnevil>
Component: sudoAssignee: Daniel Kopeček <dkopecek>
Status: CLOSED WONTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 14CC: dkopecek, kzak
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-08-16 18:01:36 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Daris A Nevil 2011-01-06 17:02:32 UTC
Description of problem:

When I do 'sudo {cmd}', the HOME environment variable is set to the home directory of the target user.  Fedora 12 and earlier do not modify the HOME environment variable.

Version-Release number of selected component (if applicable):

sudo-1.7.4p4-4.fc14.x86_64

How reproducible:

Deterministic.

Steps to Reproduce:
1. Setup /etc/sudoers.d/xxx to allow you to sudo to root.
2. Do sudo sh
3. Do echo $HOME Or echo ~

Actual results:

Home of the root user (/root).

Expected results:

Home of the original user.

Additional info:

The problem is fixed by adding the line

  Defaults    env_keep += "HOME"

to the file /etc/sudoers.

See Also:

https://bugzilla.redhat.com/show_bug.cgi?id=635250
http://www.sudo.ws/pipermail/sudo-users/2010-September/004478.html

Comment 1 Daris A Nevil 2011-01-06 17:29:06 UTC
More info from a colleague.

It has to do with sudo being built with the –with-secure-path flag.  There have been outstanding bugs with other distributions for this issue for a while.  Interesting that Fedora adopted this default behavior as well.

https://bugs.launchpad.net/ubuntu/+source/sudo/+bug/50797
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=85123

It even looks like Fedora tried this before in FC10, and it was fixed, so they’ve reintroduced the issue in FC14.

https://bugzilla.redhat.com/show_bug.cgi?id=471603

Comment 2 Fedora End Of Life 2012-08-16 18:01:39 UTC
This message is a notice that Fedora 14 is now at end of life. Fedora 
has stopped maintaining and issuing updates for Fedora 14. It is 
Fedora's policy to close all bug reports from releases that are no 
longer maintained.  At this time, all open bugs with a Fedora 'version'
of '14' have been closed as WONTFIX.

(Please note: Our normal process is to give advanced warning of this 
occurring, but we forgot to do that. A thousand apologies.)

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, feel free to reopen 
this bug and simply change the 'version' to a later Fedora version.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we were unable to fix it before Fedora 14 reached end of life. If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora, you are encouraged to click on 
"Clone This Bug" (top right of this page) and open it against that 
version of Fedora.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping