for normal user I get :
/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/monty/google_appengine
which is actually the content of /etc/environment
For root I get:
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
what's the reason behind this and which file contains this line?
Best Answer
PATH is an environment variable, and therefor it 'defaults' or 'resets' when you change environment. See
man sudoers
for an explanation:is the basic path without modifications. Different users will have different directories added to them for several reasons.
And the reasoning should be: root should never ever have more directories in its PATH than needed. Or the other way around: if root needs a file it should be in
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
. You do not play games as root. You do not use a desktop manager as root. A root is for admin tasks.The wiki has some more information (amongst others which files are used to add to PATH): https://help.ubuntu.com/community/EnvironmentVariables