|Summary:||sudo inherits $HOME from invoking user in interactive shell, but not in a script.|
|Product:||[Fedora] Fedora||Reporter:||Andrew Toskin <andrew>|
|Component:||sudo||Assignee:||Daniel Kopeček <dkopecek>|
|Status:||CLOSED EOL||QA Contact:||Fedora Extras Quality Assurance <extras-qa>|
|Version:||25||CC:||dkopecek, kzak, rsroka, tosykora|
|Fixed In Version:||Doc Type:||If docs needed, set a value|
|Doc Text:||Story Points:||---|
|Last Closed:||2017-12-12 10:28:09 UTC||Type:||Bug|
|oVirt Team:||---||RHEL 7.3 requirements from Atomic Host:|
|Cloudforms Team:||---||Target Upstream Version:|
Description Andrew Toskin 2017-02-07 01:16:21 UTC
When I run `sudo echo "$HOME"` in an interactive shell, it prints my own home directory. If I write a shell script containing `echo "$HOME"` and then run the script with sudo, it prints the home for root (`/root`). This is confusing behavior. I'm using sudo 1.8.18p1 on Fedora 25 Workstation x86_64. I've tried this with both fish 2.3.1 and bash 4.3.43(1)-release in GNOME Terminal 3.22.1. I have only modified the sudoers config a little: ``` $ sudo cat /etc/sudoers.d/00_custom Defaults env_keep += "EDITOR VISUAL" Defaults env_keep += "PAGER LESS MANOPT" Defaults env_keep += "XZ_DEFAULTS" Defaults secure_path = /home/terrycloth/apps:/home/terrycloth/bin:/home/terrycloth/.local/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin ``` Interestingly, "$USER" stays the same (my username) on both the CLI and in scripts.
Comment 1 Fedora End Of Life 2017-11-16 18:58:20 UTC
This message is a reminder that Fedora 25 is nearing its end of life. Approximately 4 (four) weeks from now Fedora will stop maintaining and issuing updates for Fedora 25. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as EOL if it remains open with a Fedora 'version' of '25'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version. Thank you for reporting this issue and we are sorry that we were not able to fix it before Fedora 25 is 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 change the 'version' to a later Fedora version prior this bug is closed as described in the policy above. 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.
Comment 2 Fedora End Of Life 2017-12-12 10:28:09 UTC
Fedora 25 changed to end-of-life (EOL) status on 2017-12-12. Fedora 25 is no longer maintained, which means that it will not receive any further security or bug fix updates. As a result we are closing this bug. If you can reproduce this bug against a currently maintained version of Fedora please feel free to reopen this bug against that version. If you are unable to reopen this bug, please file a new report against the current release. If you experience problems, please add a comment to this bug. Thank you for reporting this bug and we are sorry it could not be fixed.