The '-' in the 'su -' command you are running forces a login shell when the command executes, loading root's environment and parking you in his home directory.<br><br>If you run it without the hyphen, you will be root, but without the other environment variables set (PATH, etc.). This will also keep you in the current directory.<br>
<br>Jason<br><br><div class="gmail_quote">On Wed, Mar 9, 2011 at 2:08 AM, Steve VanSlyck <span dir="ltr"><<a href="mailto:s.vanslyck@spamcop.net">s.vanslyck@spamcop.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div>
I've asked Google, but Google wasn't feeling very helpful.<br>
<br>
When I become root via the "SU -" command, my current working directory is changed to root's home.<br>
<br>
"info su" says, <font color="#0000ff"><b>"By default, 'su' does not change the current directory. It sets the environment variables 'HOME' and 'SHELL' from the password entry for USER, and if USER is not the super-user, sets 'USER' and 'LOGNAME' to USER."</b></font><br>
<br>
I think that means that SU asks root what directory to change to. Are there any hints or tips someone can give me on how to prevent SU from changing the current working directory, ideally without having to modify root's environment variables?<br>
<br>
</div>
<br>Spam detection software, running on the system "<a href="http://lists.colug.net" target="_blank">lists.colug.net</a>", has<br>
identified this incoming email as possible spam. The original message<br>
has been attached to this so you can view it (if it isn't spam) or label<br>
similar future email. If you have any questions, see<br>
the administrator of that system for details.<br>
<br>
Content preview: I've asked Google, but Google wasn't feeling very helpful.<br>
When I become root via the "SU -" command, my current working directory is<br>
changed to root's home. "info su" says, "By default, 'su' does not change<br>
the current directory. It sets the environment variables 'HOME' and 'SHELL'<br>
from the password entry for USER, and if USER is not the super-user, sets<br>
'USER' and 'LOGNAME' to USER." [...]<br>
<br>
Content analysis details: (5.0 points, 5.0 required)<br>
<br>
pts rule name description<br>
---- ---------------------- --------------------------------------------------<br>
3.8 BAYES_99 BODY: Bayes spam probability is 99 to 100%<br>
[score: 1.0000]<br>
1.2 DATE_IN_PAST_03_06 Date: is 3 to 6 hours before Received: date<br>
0.0 HTML_MESSAGE BODY: HTML included in message<br>
<br>
<br>
<br>_______________________________________________<br>
colug-432 mailing list<br>
<a href="mailto:colug-432@colug.net">colug-432@colug.net</a><br>
<a href="http://lists.colug.net/mailman/listinfo/colug-432" target="_blank">http://lists.colug.net/mailman/listinfo/colug-432</a><br>
<br>Spam detection software, running on the system "<a href="http://lists.colug.net" target="_blank">lists.colug.net</a>", has<br>
identified this incoming email as possible spam. The original message<br>
has been attached to this so you can view it (if it isn't spam) or label<br>
similar future email. If you have any questions, see<br>
the administrator of that system for details.<br>
<br>
Content preview: I've asked Google, but Google wasn't feeling very helpful.<br>
When I become root via the "SU -" command, my current working directory is<br>
changed to root's home. "info su" says, "By default, 'su' does not change<br>
the current directory. It sets the environment variables 'HOME' and 'SHELL'<br>
from the password entry for USER, and if USER is not the super-user, sets<br>
'USER' and 'LOGNAME' to USER." [...]<br>
<br>
Content analysis details: (5.0 points, 5.0 required)<br>
<br>
pts rule name description<br>
---- ---------------------- --------------------------------------------------<br>
3.8 BAYES_99 BODY: Bayes spam probability is 99 to 100%<br>
[score: 1.0000]<br>
1.2 DATE_IN_PAST_03_06 Date: is 3 to 6 hours before Received: date<br>
0.0 HTML_MESSAGE BODY: HTML included in message<br>
<br>
<br>
<br></blockquote></div><br>