Add $HOME/bin to PATH for a single user in Debian Wheezy with LXDE

1,772

Solution 1

It turned out that lightdm (the login manager LXDE now uses) does not source ~/.profile.

What worked for me was creating ~/.xsessionrc:

if [ -d $HOME/bin ]; then
    export PATH="$HOME/bin:$PATH"
fi

You can also add this to /etc/X11/Xsession.d/90userbinpath if you want all user to benefit from this (each user would benefit for his own path) with a system-wide configuration.

Solution 2

You can try the /etc/profile.

nano /etc/profile

There will be two kinds of PATH, the path for the root, and the path for normal users, non-root. So you just add to the root or normal users the /$HOME/bin on the final of the line Ctrl+O and Ctrl+X and there you go :). Remember that you need root to do this operation.

Or, you can go to your home and look at the .profile there.

cd /home/YOURUSERNAME
nano .profile

In debian it automatically does it too(add the bin to the path). Do a echo $HOME to see what home is.

Share:
1,772

Related videos on Youtube

user1747781
Author by

user1747781

Updated on September 18, 2022

Comments

  • user1747781
    user1747781 over 1 year


    I have written a socket-server like here. If I type ctrl+c in telnet, the server don't do anything now. I want to catch it like signal(SIGINT,SIG_IGN)
    How can I do?

    • Admin
      Admin almost 10 years
      Note: Since you speak in the third person, there is a possibility that the user is not you. Then it is considered rude to modify his settings yourself (unless he asked it explicitly, of course).
    • Admin
      Admin almost 10 years
      Don't worry, the user is me.
  • sashoalm
    sashoalm almost 10 years
    This will work for a X session/GUI programs, not just for terminal, right?
  • radianz
    radianz almost 10 years
    This will work for both cases GUI and terminal.
  • sashoalm
    sashoalm almost 10 years
    OK, I thought GUI programs don't inherit from .bashrc, unless started from a terminal.
  • goldilocks
    goldilocks almost 10 years
    Beware you could end up adding $HOME/bin to the end of $PATH multiple times this way: unix.stackexchange.com/questions/124444/…
  • sashoalm
    sashoalm almost 10 years
    OK, .bashrc doesn't work - it seems to work only for programs I start from xterm, but not for programs I start using "Alt+F2", i.e. from LXDE (the DE I use). The DE uses a login manager, not startx.
  • sashoalm
    sashoalm almost 10 years
    That would be global for all users, I specifically pointed out "for a single user". Wouldn't it be better to use ~/.profile instead?
  • ranu
    ranu almost 10 years
    @sashoalm, edited :)
  • sashoalm
    sashoalm almost 10 years
    OK, but .profile doesn't seem to be executed at all. Is it the correct file to use? echo $PATH does not show my changes, even from a terminal. I don't have ~/.bash_profile or ~/.bash_login.
  • ranu
    ranu almost 10 years
    Try to exit your session and make a login again, well I don't know if it is the correct file to use, but every user has one, so it would be the answer for your question...
  • sashoalm
    sashoalm almost 10 years
    Yes, I did that, but it doesn't seem to be read at all. I posted a new question about that - unix.stackexchange.com/questions/131320/…
  • ranu
    ranu almost 10 years
    And more, if you are logged as a user the echo $HOME would looks like: /home/yourUserName/. When you look at the .profile at the home directory in the final lines you can see that the script add the /bin if it exists. If its not your case I can paste the code for you.
  • sashoalm
    sashoalm almost 10 years
    I think the problem is I use lxdm - unix.stackexchange.com/a/90946/9108
  • ranu
    ranu almost 10 years
    Yea, that's the problem :(
  • sashoalm
    sashoalm almost 10 years
    Advice worthy of a Windows support tech. If all else fails, make clean reinstall ;) But too late, I already solved the problem - unix.stackexchange.com/a/131327/9108
  • ranu
    ranu almost 10 years
    Congrats hehe ;)
  • radianz
    radianz almost 10 years
    Check my updated answer for running programs using Alt+F2