Have recently installing Debian Wheezy and using XFCE with lighdm.

After logging in with lightdm, my ~/.bash_profile or ~/.profile are no longer sourced. I have previously used these startup files to start ssh-agent, dropboxd and set my PATH variable.

If I understand this link (http://wiki.debian.org/DotFiles) correctly, when a display manager is in use (lightdm in this case). Then it is correct that these files do not get sourced.

So my questions are:
1) how can I make XFCE/lightdm source ~/.bash_profile or ~/.profile
2) what are the equivalent startup configuration files of XFCE/lightdm to start ssh-agent, dropboxd and set my PATH variable.


I've also struggled a lot with this environment variable thing. I'm using Debian Jessie + xfce4

The options that worked for me are(for the environment variables to be caught by the desktop manager):

  • With xdm or lightdm: use ~/.xsessionrc
  • With others, I haven't tested

In the ~/.xsessionrc you may chose to :

  • put directly the variables, like PATH="$PATH:userpath"
  • or source the ~/.profile file: . $HOME/.profile, where the ~/.profile file contains the environment variables definitions

Note the dot in the second option which means source, but I think source is bash specific. The second method is probably recommended (as argued in https://unix.stackexchange.com/questions/4621/correctly-setting-environment) and avoid having the environment variables defined in several files. Also, it's user-specific and not system-wide like (/etc/environment, which actually didn't work so well for me)

For terminal session, since I use bash, I set-up the environment variables in the .bash_profile or I just source the ~/.profile

  • Thanks alot ! Finally! I had to search alot to find this easy solution. One thing to mention: If the file ~/.xsessionrc does not exist, just create it ! – Alex Aug 22 '14 at 15:09
  • 1
    At first in ~/.xsessionrc I put . ~/.profile and it did not work. As stated in this answer if the content is . $HOME/.profile then it works. – Stéphane Gourichon Mar 17 '16 at 19:57

OK eventually found a workable solution and went with 2)

To set my PATH variable.
$ cp /etc/xdg/xfce4/xinitrc ~/.config/xfce4
Then edited ~/.config/xfce4/xinitrc to include the following near the top of the file

if [ -d "${HOME}/bin" ] ; then

To start Dropbox when XFCE4 starts
$ xfce4-settings-manager
-> Session and Startup -> "Application Autostart" tab -> Add ->
Name: Dropbox
Command: /home/james/.dropbox-dist/dropboxd
-> OK

As for ssh-agent this gets started in the default xinitrc. (Can anyone recommend a GUI program to supply the passphrase)

Hope this is of assistance.

  • 1
    Copying and editing a file from /etc/ smells. If the packages updates the original file your copy won't be updated. An alternative would be to copy no content but exec /etc/xdg/xfce4/xinitrc from your ~/.config/xfce4/xinitrcright after your specific setup. Anyway I prefer the other .profile-based solution, which seems less specific to xfce or lightdm. Thanks for sharing! – Stéphane Gourichon Mar 17 '16 at 20:33
  • GUI program to supply the passphrase: ssh-askpass-gnome, ssh-askpass, ssh-askpass-fullscreen. Also recommend GNU Keychain for keychain management. – fatal_error Dec 6 '16 at 22:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.