[colug-432] Prevent SU from changing CWD

Jason Marshall jason.marshall at gmail.com
Wed Mar 9 09:39:20 EST 2011


Well, now I feel redundant... :) I missed the rest of the thread in my mail
client.

Jason

On Wed, Mar 9, 2011 at 9:38 AM, Jason Marshall <jason.marshall at gmail.com>wrote:

> 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.
>
> 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.
>
> Jason
>
> On Wed, Mar 9, 2011 at 2:08 AM, Steve VanSlyck <s.vanslyck at spamcop.net>wrote:
>
>>  I've asked Google, but Google wasn't feeling very helpful.
>>
>> When I become root via the "SU -" command, my current working directory is
>> changed to root's home.
>>
>> "info su" says, *"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."*
>>
>> 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?
>>
>>
>> Spam detection software, running on the system "lists.colug.net", has
>> identified this incoming email as possible spam.  The original message
>> has been attached to this so you can view it (if it isn't spam) or label
>> similar future email.  If you have any questions, see
>> the administrator of that system for details.
>>
>> Content preview:  I've asked Google, but Google wasn't feeling very
>> helpful.
>>
>>   When I become root via the "SU -" command, my current working directory
>> is
>>   changed to root's home. "info su" says, "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." [...]
>>
>>
>> Content analysis details:   (5.0 points, 5.0 required)
>>
>>  pts rule name              description
>> ---- ----------------------
>> --------------------------------------------------
>>  3.8 BAYES_99               BODY: Bayes spam probability is 99 to 100%
>>                            [score: 1.0000]
>>  1.2 DATE_IN_PAST_03_06     Date: is 3 to 6 hours before Received: date
>>  0.0 HTML_MESSAGE           BODY: HTML included in message
>>
>>
>>
>> _______________________________________________
>> colug-432 mailing list
>> colug-432 at colug.net
>> http://lists.colug.net/mailman/listinfo/colug-432
>>
>> Spam detection software, running on the system "lists.colug.net", has
>> identified this incoming email as possible spam.  The original message
>> has been attached to this so you can view it (if it isn't spam) or label
>> similar future email.  If you have any questions, see
>> the administrator of that system for details.
>>
>> Content preview:  I've asked Google, but Google wasn't feeling very
>> helpful.
>>
>>   When I become root via the "SU -" command, my current working directory
>> is
>>   changed to root's home. "info su" says, "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." [...]
>>
>>
>> Content analysis details:   (5.0 points, 5.0 required)
>>
>>  pts rule name              description
>> ---- ----------------------
>> --------------------------------------------------
>>  3.8 BAYES_99               BODY: Bayes spam probability is 99 to 100%
>>                            [score: 1.0000]
>>  1.2 DATE_IN_PAST_03_06     Date: is 3 to 6 hours before Received: date
>>  0.0 HTML_MESSAGE           BODY: HTML included in message
>>
>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.colug.net/pipermail/colug-432/attachments/20110309/ca8245d0/attachment.html 


More information about the colug-432 mailing list