Summary: | Add reminder to docs that /etc/env.d is for login shells ONLY(WAS: app-admin/sudo-1.8.5_p2: environment variable in /etc/env.d has no effect) | ||
---|---|---|---|
Product: | [OLD] Docs on www.gentoo.org | Reporter: | lsching17 |
Component: | Installation Handbook | Assignee: | Docs Team <docs-team> |
Status: | RESOLVED INVALID | ||
Severity: | enhancement | ||
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- |
Description
lsching17
2012-06-11 21:03:00 UTC
1) /etc/env.d is by default only loaded for login shells -- `sudo env' doe not spawn a login shell 2) sudo resets the environment for security reasons. See the -E switch and the env_keep/env_reset options (I guess in man sudoers) to configure this behavior. All in all, not a bug. May i ask a question before closing this report? sudo will load variable from /etc/environment after resetting environment, This kind of "global" environment variables may be needed for scripts to function properly (e.g. path, url). It is normal to expect program which work properly in root login shell will work in sudo too. The -E option may introduce security risk and is totally 2 different thing. As the recommend Gentoo way to set environment variable is in /etc/env.d http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2&chap=5 If this "way" is limited to login shell only, please consider update the documentation to remind user about this. (In reply to comment #2) > If this "way" is limited to login shell only, please consider update the > documentation to remind user about this. Agreed. (In reply to comment #3) > (In reply to comment #2) > > If this "way" is limited to login shell only, please consider update the > > documentation to remind user about this. > > Agreed. since our docs only cover using "su" and not "sudo" i don't see anything that we need to change. nowhere do we say to run "sudo env" so i don't see this as a valid bug. (In reply to comment #4) `su` also doesn't spawn a login shell. it does a rc shell by default. this isn't related to sudo or su anything else. this is generally how things work -- you start with a login shell which seeds things, and then you spawn rc shells after that which inherits the env the login shell started up. |