3

In /etc/login.defs what are ENV_PATH and ENV_SUPATH used for?

From /etc/login.defs:

 # REQUIRED  The default PATH settings, for superuser and normal users.  
 #  
 # (they are minimal, add the rest in the shell startup files)  
 ENV_SUPATH   PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin  
 ENV_PATH     PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games  
  • They seem to default to the same exact initial path values that I have for PATH in /etc/profile in Debian Jessie.

  • In man it says very briefly what login.defs is used for. This page says a bit more.

PATH and ENV_PATH don't appear to be connected or dependent on one another, or if they are it's not obvious to me how one depends on the other.

Do I need to update my bash system paths in both of these two places? Or is there a way to have paths defined in only one place, and to refer to this master path value?

Or perhaps are these just used as a default in the case that PATH is missing? ... So they don't really matter that much ???

4

Quoting the man page about login.defs

ENV_PATH (string) If set, it will be used to define the PATH environment variable when a regular user login. The value is a colon separated list of paths (for example /bin:/usr/bin) and can be preceded by PATH=. The default value is PATH=/bin:/usr/bin.

ENV_SUPATH (string) If set, it will be used to define the PATH environment variable when the superuser login. The value is a colon separated list of paths (for example /sbin:/bin:/usr/sbin:/usr/bin) and can be preceded by PATH=. The default value is PATH=/sbin:/bin:/usr/sbin:/usr/bin.

Both are used to define the PATH variable of regular, super user initially. My login.defs has the ENV_PATH, ENV_SUPATH defined to following

ENV_SUPATH      PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin  
ENV_PATH        PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games

I added a new user 'foo'

sudo useradd foo

sudo passwd foo                                                                                                     
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

When i login as 'foo'

foo@naga-playground:/$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games

Similarly for 'root'

root@naga-playground:/home/pi/# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

The PATH can be overridden by the user via .bashrc, .bash_profile, .zshrc ...

To make the answer complete
ENV_PATH is used to define PATH for a regular user
ENV_SUPATH is used to define PATH for a super user

2
  • Thanks. So is it a temporary initial value for a newly created user's PATH, which can then later be overwritten by ~/.bashrc or the like once that is setup? Oct 19 '16 at 0:21
  • 1
    Yes, it is the initial value of PATH environment variable Oct 19 '16 at 0:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.