Skip to contentSkip to conversation

New su utility messes with my PATH

su Thomas Bächler 4 participants 6 messages Sep 15, 2012 – Oct 2, 2012 Util-Linux package

lore
Share & tools
lore
#0 lore raw

I found what I think is absolutely unexpected behaviour in the new su utility. It seems to have been introduced by commit a6fdd3f8.

It is about /sbin and /usr/sbin being in the path: Whenever you switch to a non-root user, they are removed from the path, and when you switch to root, they are added. I find it completely unexpected that su (when not running with -l) messes with my environment at all.

Commands like
PATH=... su -c "cmd" user
do not work as expected.

In my opinion, when you wish your path (or anything in the environment) to change you should a) use -l to start a login shell or b) configure your scripts to take care of it.

I propose to revert the mentioned patch. Opinions?

#1 lore raw
Quoted 12 lines · Thomas Bächler

I found what I think is absolutely unexpected behaviour in the new su utility. It seems to have been introduced by commit a6fdd3f8.

It is about /sbin and /usr/sbin being in the path: Whenever you switch to a non-root user, they are removed from the path, and when you switch to root, they are added. I find it completely unexpected that su (when not running with -l) messes with my environment at all.

Commands like
PATH=... su -c "cmd" user
do not work as expected.

Quoted 5 lines

In my opinion, when you wish your path (or anything in the environment) to change you should a) use -l to start a login shell or b) configure your scripts to take care of it.

I propose to revert the mentioned patch. Opinions?

Ouch, I agree.
su shouldn't be messing with PATH at all IMHO.

cheers,
Pádraig.

maintainer
#2 lore raw
Quoted 13 lines · Pádraig Brady
Quoted 12 lines · Thomas Bächler

I found what I think is absolutely unexpected behaviour in the new su utility. It seems to have been introduced by commit a6fdd3f8.

It is about /sbin and /usr/sbin being in the path: Whenever you switch to a non-root user, they are removed from the path, and when you switch to root, they are added. I find it completely unexpected that su (when not running with -l) messes with my environment at all.

Commands like
PATH=... su -c "cmd" user
do not work as expected.

Quoted 8 lines
Quoted 5 lines

In my opinion, when you wish your path (or anything in the environment) to change you should a) use -l to start a login shell or b) configure your scripts to take care of it.

I propose to revert the mentioned patch. Opinions?

Ouch, I agree.
su shouldn't be messing with PATH at all IMHO.

It's Suse patch, I guess there is/was any reason for the patch

commit a6fdd3f8125be23930d955c2bc6b7a46cdaf8a12
Author: Werner Fink <[email protected]>
Date: Tue Aug 17 09:09:55 2010 +0200

make sure /sbin resp /usr/sbin are in PATH

Werner, Ludwig? What about to revert the patch?

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com
#3 lore raw
Quoted 14 lines · Karel Zak
Quoted 13 lines · Pádraig Brady
Quoted 12 lines · Thomas Bächler

I found what I think is absolutely unexpected behaviour in the new su utility. It seems to have been introduced by commit a6fdd3f8.

It is about /sbin and /usr/sbin being in the path: Whenever you switch to a non-root user, they are removed from the path, and when you switch to root, they are added. I find it completely unexpected that su (when not running with -l) messes with my environment at all.

Commands like
PATH=... su -c "cmd" user
do not work as expected.

Quoted 8 lines
Quoted 8 lines
Quoted 5 lines

In my opinion, when you wish your path (or anything in the environment) to change you should a) use -l to start a login shell or b) configure your scripts to take care of it.

I propose to revert the mentioned patch. Opinions?

Ouch, I agree.
su shouldn't be messing with PATH at all IMHO.

Well, su is such a mess that you better not make any assumptions about it. Avoid su if you can.

Quoted 10 lines

It's Suse patch, I guess there is/was any reason for the patch

commit a6fdd3f8125be23930d955c2bc6b7a46cdaf8a12
Author: Werner Fink <[email protected]>
Date: Tue Aug 17 09:09:55 2010 +0200

make sure /sbin resp /usr/sbin are in PATH

Werner, Ludwig? What about to revert the patch?

Personally I don't really mind. I don't know the background of the patch though. IMO using 'su' instead of 'su -' is broken anyways so making the former less convenient may help teaching people to use 'su -' instead.

cu
Ludwig

Signature · 4 lines
 (o_   Ludwig Nussel
 //\
 V_/_  http://www.suse.de/
SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg) 
maintainer
#4 lore raw
In reply to Karel Zak
Quoted 8 lines · Karel Zak

commit a6fdd3f8125be23930d955c2bc6b7a46cdaf8a12
Author: Werner Fink <[email protected]>
Date: Tue Aug 17 09:09:55 2010 +0200

make sure /sbin resp /usr/sbin are in PATH

Werner, Ludwig? What about to revert the patch?

Reverted.

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com
#5 lore raw

Am 02.10.2012 10:17, schrieb Karel Zak:

Quoted 5 lines · Karel Zak
Quoted 4 lines
        commit a6fdd3f8125be23930d955c2bc6b7a46cdaf8a12
        Author: Werner Fink <[email protected]>
        Date:   Tue Aug 17 09:09:55 2010 +0200
Quoted 8 lines
Quoted 4 lines

make sure /sbin resp /usr/sbin are in PATH

Werner, Ludwig? What about to revert the patch?

Reverted.

Karel

Thank you, much appreciated.