Why is ~/.local/bin/ not in PATH ?

Forum Forums New users New Users and General Questions Why is ~/.local/bin/ not in PATH ?

  • This topic has 4 replies, 3 voices, and was last updated Nov 16-5:14 pm by Brian Masinick.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #70997
    Member
    seriousness

      Hello, I want to place scripts in my ~/.local/bin/ folder like I do in Ubuntu and start them by their name.
      According to ~/.profile the folder should be in PATH:

      # set PATH so it includes user's private bin if it exists
      if [ -d "$HOME/.local/bin" ] ; then
          PATH="$HOME/.local/bin:$PATH"
      fi

      but it isn’t. What is the best way to get it working?

      #71034
      Member
      sybok
        Helpful
        Up
        0
        ::

        Not sure if this applies to ordinary user, sudo or root.
        There was a change in behavior of ‘sudo’ (see man-page and related switch ‘-E’).
        Also, if there are more files, they are sourced in specific order and not necessarily all of them, see
        https://unix.stackexchange.com/questions/131320/profile-is-not-sourced-in-debian-wheezy-lxde

        Probably a nasty solution:
        1) verification: define a global variable in ‘~/.profile’
        2) start a new shell, test if the variable is there
        3) if not, then explicitly source ‘~/.profile’ in your shell, e.g. add a line into your ‘~/.bash_profile’ or ‘~/.bashrc’
        source $HOME/.profile

        #71045
        Member
        seriousness
          Helpful
          Up
          0
          ::

          The solution I found in another thread is telling ROXTerm to run shells as login shells.

          This is done by checking “Login shell” in Preferences –> Edit Current Profile –> “Command” tab.

          What I do not yet understand completely is, why it’s a security risk to have ~/bin or ~/.local/bin in PATH as mentioned in some other threads.

          #71046
          Member
          sybok
            Helpful
            Up
            0
            ::

            I am definitely not an expert but I guess it might be like I suggest below:
            – If you download some virus/compromised file, then it may easily put an infected binary there (since no elevated privileges are required).
            – The local-bin is prepended to the path.
            I.e. I would expect when calling a binary/command, the system will probably “look there” first.

            #71048
            Moderator
            Brian Masinick
              Helpful
              Up
              0
              ::

              I am definitely not an expert but I guess it might be like I suggest below:
              – If you download some virus/compromised file, then it may easily put an infected binary there (since no elevated privileges are required).
              – The local-bin is prepended to the path.
              I.e. I would expect when calling a binary/command, the system will probably “look there” first.

              I recommend appending any additional directories to the end of the path for this reason (if at all).

              Another possibility is to include additional path specs in short scripts containing specific shortcuts or functions. The paths will not persist unless you explicitly export them and they will have to be performed or called each time but that’s much safer. (You could call them through the login configuration but again you may unintentionally compromise security).

              --
              Brian Masinick

            Viewing 5 posts - 1 through 5 (of 5 total)
            • You must be logged in to reply to this topic.