William Hooper wrote:
Bevan C. Bennett said:
su works because you end up with root's environment variables (and
path), thus avoiding consolehelper entirely.
No you don't:
[whooper@kenny whooper]$ su -c printenv | grep PATH
Password:
JAVA_PATH=/usr/java/j2re1.4.2_02
PATH=/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/usr/java/j2re1.4.2_02/bin:/home/whooper/bin
[whooper@kenny whooper]$ sudo printenv | grep PATH
JAVA_PATH=/usr/java/j2re1.4.2_02
PATH=/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/usr/java/j2re1.4.2_02/bin:/home/whooper/bin
[whooper@kenny whooper]$ su -c "which up2date"
Password:
/usr/bin/up2date
[whooper@kenny whooper]$ sudo which up2date
/usr/bin/up2date
[whooper@kenny whooper]$
I assume they use xauth differently and that is why one works and the
other doesn't.
"su" simply changes your UID and GID to root's. "su -" gives you root's
environment as well.
----------------------------------------------------------------------
- Rick Stevens, Senior Systems Engineer rstevens@xxxxxxxxxxxxxxx -
- VitalStream, Inc. http://www.vitalstream.com -
- -
- Microsoft Windows: Proof that P.T. Barnum was right -
----------------------------------------------------------------------