Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

executing scripts in current folder 1

Status
Not open for further replies.

BJZeak

Programmer
May 3, 2008
230
0
16
CA
how does one force ubuntu to look in the current folder for executables?

I have to use ./<blah> to get it to execute scripts which is a pain

 
It is for security reasons that the current folder is not in your search path by default.

This is to protect you from accidentally running trojans (e.g. someone could write one called "ls" or something similar that is used frequently, or password harvesting tools, e.g. called "su") that people have dropped in a directory that you just happen to be sitting in when you run it.

There's nothing to stop you adding "." to your PATH though if you wish.

Code:
PATH=$PATH:.

Annihilannic
[small]tgmlify - code syntax highlighting for your tek-tips posts[/small]
 
If the pain comes from the point-slash, you have two more solutions:

o alias. Example:
alias goForIt="./goforit.bin"

You place it in your ~/.bashrc not to retype it each time you restart.

o place a symbolic link into your /home/user/bin directory. Example:
ln -s /your/path/to/app/goforit.bin /home/user/bin
 
Hi

FlorianAwk said:
alias goForIt="./goforit.bin"
The vulnerability is the same as including . in the [tt]PATH[/tt]. The only difference is, this applies to a single file, not all. But if a bad guy creates a nasty /tmp/goforit.bin script, if you will ever execute goForIt in the /tmp/ directory you get in trouble. The alias advice is good, but use absolute path.

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top