Debian $PATH variable change

2019-01-23 16:38发布

How can I change the $PATH variable in Debian? I tried to change /etc/profile but this affected only normal users (and yes, I added path to BOTH user's and root's paths).

After that I tried to edit /root/.profile and then /root/.bashrc also ...

Neither worked. Do you know where could be problem?

3条回答
Juvenile、少年°
2楼-- · 2019-01-23 17:02

This is set in the /etc/login.defs on debian 6.0 .

These are the lines you have to edit:

# *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

EDIT:

I forgot to put where I found the solution: https://serverfault.com/questions/166383/how-set-path-for-all-users-in-debian

查看更多
ら.Afraid
3楼-- · 2019-01-23 17:06

Edit your /etc/.profile to include set -vx near the top. Restart from fresh window. Then you can see what '.' files are processed AND where PATH is being reset.

Also, confirm that you are really in the shell that you think. After all startup scripts are finished, do echo $SHELL and confirm the value = the shell you expect, most likely bash.

I hope this helps.

查看更多
The star\"
4楼-- · 2019-01-23 17:16

Modify /etc/environment to include a line like this:

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
查看更多
登录 后发表回答