Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to add a directory to the path and why ./ is b
#1

How to add a directory to the path and why ./ is bad

 

By default there is a limited set of directories that are part of the path. This means that only files that are marked executable and in one of these dirs will be able to be run. The other way to run programs not in the path is to provide the full path to the program, or if it is in the current working directory then you put ./ before it e.g. ./progname. Sometime you will want to add a directory to the path, so that programs and scripts can be placed in this dir and run from anywhere on your system.

 

The easiest way to accomplish this is to edit the /etc/profile for system wide changes or ~user/.bash_profile for user based changes. There will be an entry like PATH=$PATH:$HOME/bin and all you will have to do is edit this line. I would recommend not adding the current working directory (./) to the path as this can present a potential security hole. Apache and other programs can access scripts and if they have the ability to address the CWD then they could be accessing programs that have no wish to be run.

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)