0

I assume this question has be asked many times.I just can't manage to change the PATH var permanently. This is what I do:

nano ~/.profile 
export PATH=$PATH:/my/additional/path
save changes

I even created the ~/.pam_environment file to try to define the PATH in there but it simply want last after the new login;.

What am I doing wrong? p.s. Im currently on Debian 8

Milan
  • 1
  • I would think the .pam_environment should work. The .profile .bash_profile and .bashrc files are sourced after pam environment though so depending on what sort of shell you are interacting with (or not) they may be overwriting the PATH variable if it's set in one of those files. – jesse_b Aug 12 '17 at 12:52
  • How will each path be unique for each user? Will it be in a common location in their user directory or a common directory that stores all user specific directories? If so like Christopher suggested you could still add that to the /etc/skel/.bashrc file as something like: export PATH=$PATH:$HOME/usr/bin or PATH=$PATH:/usr/$USER/bin or PATH=$PATH:/usr/$(whoami)/bin – jesse_b Aug 12 '17 at 12:57
  • .profile is the right place. How do you log into the account (GUI login, text console, SSH, …)? What is the value of PATH? What other dot files does the user have? What is the user's login shell? Post the output of bash --login -x. – Gilles 'SO- stop being evil' Aug 12 '17 at 21:57
  • Im using /bin/sh and would like to set a different PATH for each user in a .dot file in their home direcoty. That sound most logical to me. Gilles: when I do bash --login -x or -lx I see that the bash sets the PATH var as I wish to, but when I exit -lx and echo $PATH it goes back to the previous state. Maybe one file is overwriting the other or something? – Milan Aug 13 '17 at 07:18

1 Answers1

1

you need to edit the files in your /etc/skel directory, you can add an .profile there with that config, or in .bash_rc. Every time you create a new user it will take all the files from /etc/skel

Rui F Ribeiro
  • 56,709
  • 26
  • 150
  • 232