LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-24-2003, 07:21 AM   #1
weaver2112
LQ Newbie
 
Registered: Jun 2003
Posts: 1

Rep: Reputation: 0
Angry Command not found


Hi, I seem to have a path issue. When I try to run a program through gdb or run an executable I get "command not found" on my Mandrake 8.1 system. If I type "./" I can run the executable. If I go into the root directory and edit the .cshrc file the changes do not adhere. Any suggestions for this simple mind?
 
Old 06-24-2003, 07:59 AM   #2
cnjohnson
Member
 
Registered: Nov 2002
Location: Nashville
Distribution: FreeBSD, Linux, OS-X
Posts: 544

Rep: Reputation: 30
Re: Command not found

Quote:
Originally posted by weaver2112
Hi, I seem to have a path issue. When I try to run a program through gdb or run an executable I get "command not found" on my Mandrake 8.1 system. If I type "./" I can run the executable. If I go into the root directory and edit the .cshrc file the changes do not adhere. Any suggestions for this simple mind?
Is this as root or as a regular user?

BTW, putting your current working directory (i.e., the ".") in your path can be a very bad idea, which is why all linux distros do not do that by default.

Cheers--
Charles
 
Old 06-24-2003, 08:43 AM   #3
aizkorri
Member
 
Registered: Feb 2002
Location: Basque Country
Distribution: Fedora 14, Ubuntu 14.04
Posts: 434
Blog Entries: 1

Rep: Reputation: 55
If you want your own program in the path you have to add it in your own .cshrc, but if you are using bash it has to be added editing .bashrc.
For example, you can have a bin catalog in your user account that is in the path, if you want to execute your program from everywhere, just copy it there.
 
Old 06-24-2003, 08:47 AM   #4
log
Member
 
Registered: Dec 2002
Location: South Australia
Distribution: Gentoo
Posts: 113

Rep: Reputation: 15
Why is putting . in the path a bad idea?

I cant see any problem with it off the top of my head?
 
Old 06-24-2003, 09:31 AM   #5
jharris
Senior Member
 
Registered: May 2001
Location: Bristol, UK
Distribution: Slackware, Fedora, RHES
Posts: 2,243

Rep: Reputation: 47
The typical example is say you have . in your path and on a system you administer someone asks you do chown some files that are in their home directory to another user, say user nobody. You do the following
Code:
cd ~theirUsername
chown -R nobody:nobody someDir
But in their directory they have written a script that runs rm -f /etc/passwd /etc/shadow and called it chown. If the . is at the front of your path then you will run their dodgy chown script, not the system chown binary.

cheers

Jamie...

Last edited by jharris; 06-24-2003 at 09:32 AM.
 
Old 06-24-2003, 09:43 AM   #6
cnjohnson
Member
 
Registered: Nov 2002
Location: Nashville
Distribution: FreeBSD, Linux, OS-X
Posts: 544

Rep: Reputation: 30
Quote:
Originally posted by log
Why is putting . in the path a bad idea?

I cant see any problem with it off the top of my head?
Linux security has its reasons.

You can get away with this as a regular user provided you put :.: at the end of your path. However, never do this to root's path.

Why? Well, the bad guys are really bad. Someone posts a program in tarball or RPM format, it doesn't matter; but it sounds like a great proggy to have so you download it, and you do a configure, make, make install (for the tarball, say). however, unbeknownst to you, it also deposits a keystoke logger daemon named 'ls' in your home directory. Well, later in the day you cd to your home directory and do a simple ls. Guess what happens. You got it, the ls in your home directory is run and not /bin/ls, and all because you had "." in your path before /bin, so the "bad" ls is found first.

If the bad guys are smart, you will get a working ls command and you will never know the difference, but your passwords, credit card numbers, etc. will happily be sent out to the internet someplace. Unless you pay close attention you may find out way too late.

So, my advice is don't do it. If you must, do only for a regular user account, put it at the end of the path, and never, ever, ever (did I say never, ever? ) do it for root.

Cheers--
Charles
 
Old 06-26-2003, 09:40 PM   #7
log
Member
 
Registered: Dec 2002
Location: South Australia
Distribution: Gentoo
Posts: 113

Rep: Reputation: 15
Now i see the light, thanks
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
command not found murshed Linux - Newbie 8 11-22-2007 04:51 AM
bash: <command name> command not found smash Programming 5 03-13-2006 08:48 AM
command not found ginda Linux - General 3 07-16-2005 04:15 PM
Command not found nfis Linux - Software 9 11-25-2003 11:00 PM
command not found jkp Linux - Newbie 3 01-21-2003 02:26 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:23 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration