|www.rodneybeede.com||"I would love to change the world, but they won't give me the source code" - unknown|
This was important because when using bash and before your /etc/profile configures your PATH variable there will be an already existing value setup by the sudo -i command (or sudo -s env). This mostly affected me due to some invocations creating a PATH with two colons (::) in it which was a security issue for root since that implies the current working directory is in root's PATH.
Testing was done on a Red Hat 6. Sudo version 1.8.6p3 with 1.8.6p3-12.el6.
Before /etc/profile the sshd process sets PATH=/usr/local/bin:/bin:/usr/bin (or whatever value your OpenSSH was configured and compiled to use).
Before /etc/profile the sudo process sets PATH=/usr/bin:/bin:/usr/sbin:/sbin
sudo-1.8.6p3.tar/sudo-1.8.6p3/sudo-1.8.6p3/pathnames.h.in:#define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin" sudo-1.8.6p3.tar/sudo-1.8.6p3/sudo-1.8.6p3/plugins/sudoers/env.c: /* Provide default values for $TERM and $PATH if they are not set. */ if (!ISSET(didvar, DID_TERM)) sudo_putenv("TERM=unknown", false, false); if (!ISSET(didvar, DID_PATH)) sudo_setenv2("PATH", _PATH_STDPATH, false, true);