Pages

August 06, 2018

The new su PATH behavior

The su command that's now being packaged with Debian sid has significant change in behavior. In the past, when you did an:
$ su
the PATH would get set to root's PATH. Now, it remains the user's path:
$ su
Password:
# echo $PATH
/home/mithat/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/snap/bin
This means you won't pick up /usr/sbin where a lot of commands you'd typically use with root privileges live.

The fix to this is that you now have to append a dash to the command:
$ su -
Password:
# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
I don't know whether this impacts gksu or if sudo and/or gksudo are affected. gksu is affected as well, but with gksu there doesn't appear to be a way to get back to the old behavior.