vendredi 1 août 2014

Setup Environment Variables for XRDP in UBUNTU

when you use a xrdp client to remotely login to a ubuntu machine, you can find that the environment variables configured in the host machine are not what you can see in xrdp client.

for example, execute the following commands on both host Ubuntu machine and xrdp client machine, repectively.

echo $PATH

you can see that in your xrdp client machine, the second command returns a blank line, and the PATH variable is not identical to the one you can see in host Ubuntu machine.


  1. open the xrdp file

    sudo vim /etc/xrdp/

    Then, you can see the last line is:

    . /etc/X11/Xsession
  2. add the environment setting to xrdp startup file

    Just before the last line, add the following line:

    . /etc/environment

    And save it. . /etc/environment document defines all customized environment variables, it content is like:


  3. Then, you can start your xrdp client to connect to this Ubuntu machine, then you will see that the PATH variable is the same as you can see in the host Ubuntu machine. However, the other variables are still not exported. To solve this problem, create another file /etc/environment.xrdp, its content is like:

    export JAVA_HOME="/usr/lib/jvm/jdk-1.8.0_11"
    export JRE_HOME="/usr/lib/jvm/jdk-1.8.0_11/jre"
    export CATALINA_HOME="/opt/tomcat/apache-tomcat-8.0.9"
    export AXIS2_HOME="/opt/axis2/axis2-1.6.2"

  4. reedit the file /etc/xrdp/, add the following line before the last line:

    . /etc/environment.xrdp

    save it.
  5. Run the xrdp client again, and you will see all the variables have been successfully imported.

The cause of this problem is that, when you login remotely to a Ubuntu server, the server will load automatically to ~/.profile or ~/.bashrc for the configuration of your environment. If some variables are commonly used by all the users, you can use the above mentioned solution to solve the problem. Otherwise, each user can also customize his/her own environment variable in ~/.profile or ~./bashrc file.

Aucun commentaire:

Enregistrer un commentaire