Quantcast
Channel: Active questions tagged windows-subsystem-for-linux - Ask Ubuntu
Viewing all articles
Browse latest Browse all 2795

Cannot change user $PATH in WSL Ubuntu 24.04

$
0
0

(Please excuse my English)

I installed WSL Ubuntu 24.04 on my Windows machine, and edited /etc/environment like below to change the system-wide $PATH.

  • Before

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin"

  • After

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/mybin"

However, Only the root user' $PATH changed, and the default user's $PATH did not changed at all, like below. ('us' is the default username of WSL Ubuntu and 'SERVER' is my Windows machine name)

us@SERVER:~$ echo $PATH

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/snap/bin

us@SERVER:~$ su root

Password:

root@SERVER:/home/us# echo $PATH

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/mybin

Considering that the default user's $PATH contains the string usr/lib/wsl/lib, it seems that WSL Ubuntu sets the default user's $PATH somewhere else.

How can I modify the default user's $PATH in WSL Ubuntu?


Viewing all articles
Browse latest Browse all 2795

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>