The &#39;-&#39; in the &#39;su -&#39; command you are running forces a login shell when the command executes, loading root&#39;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">&lt;<a href="mailto:s.vanslyck@spamcop.net">s.vanslyck@spamcop.net</a>&gt;</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&#39;ve asked Google, but Google wasn&#39;t feeling very helpful.<br>
<br>
When I become root via the &quot;SU -&quot; command, my current working directory is changed to root&#39;s home.<br>
<br>
&quot;info su&quot; says, <font color="#0000ff"><b>&quot;By default, &#39;su&#39; does not change the current directory. It sets the environment variables &#39;HOME&#39; and &#39;SHELL&#39; from the password entry for USER, and if USER is not the super-user, sets &#39;USER&#39; and &#39;LOGNAME&#39; to USER.&quot;</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&#39;s environment variables?<br>

<br>
</div>

<br>Spam detection software, running on the system &quot;<a href="http://lists.colug.net" target="_blank">lists.colug.net</a>&quot;, 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&#39;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&#39;ve asked Google, but Google wasn&#39;t feeling very helpful.<br>
   When I become root via the &quot;SU -&quot; command, my current working directory is<br>
   changed to root&#39;s home. &quot;info su&quot; says, &quot;By default, &#39;su&#39; does not change<br>
   the current directory. It sets the environment variables &#39;HOME&#39; and &#39;SHELL&#39;<br>
   from the password entry for USER, and if USER is not the super-user, sets<br>
   &#39;USER&#39; and &#39;LOGNAME&#39; to USER.&quot; [...]<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 &quot;<a href="http://lists.colug.net" target="_blank">lists.colug.net</a>&quot;, 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&#39;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&#39;ve asked Google, but Google wasn&#39;t feeling very helpful.<br>
   When I become root via the &quot;SU -&quot; command, my current working directory is<br>
   changed to root&#39;s home. &quot;info su&quot; says, &quot;By default, &#39;su&#39; does not change<br>
   the current directory. It sets the environment variables &#39;HOME&#39; and &#39;SHELL&#39;<br>
   from the password entry for USER, and if USER is not the super-user, sets<br>
   &#39;USER&#39; and &#39;LOGNAME&#39; to USER.&quot; [...]<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>