xrdp changing PATH environment variable
Solution 1:
I'm not sure if this will solve your issue, since it impacts Ubuntu with XRDP and XFCE4. Still, there is a chance it does, so let's see.
I was facing a similar problem: the PATH environment variable was different when I logged into the machine through SSH and through XRDP. Concretely, when I opened a Terminal window in XRDP (xterm
), the PATH variable was not set with local user paths (~/bin
, ~/.local/bin
, etc).
However, these paths were present when I logged in through SSH.
The problem was not in XRDP, but in how the Bash session is created with XTerm and with SSH. Since SSH creates a login session, the loaded files included /etc/environment
and ~/.profile
. In the latter, the paths I required were included.
This was not the case with XTerm. It creates a non-login bash session, and thus it loads /etc/bash.bashrc
and ~/.bashrc
.
The way I could fix it was simply to include the PATH initialization line from ~/.profile
into one of these two files. Since I wanted this to impact all the users in the machine, I included it into /etc/bash.bashrc
:
echo PATH="$HOME/bin:$HOME/.local/bin:$PATH" >> /etc/bash.bashrc
You can find more information about how works in man bash