LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-09-2006, 09:42 PM   #1
xface66
LQ Newbie
 
Registered: Dec 2006
Posts: 29

Rep: Reputation: 15
file exists but can not run it.


hello everyone,

i have "authkey" file under /usr/bin
when i type "authkey" command on console it returns me
"bash: /usr/bin/authkey: No such file or directory" error.

this happens for some other files too.
what is wrong here please help me.
 
Old 12-09-2006, 10:11 PM   #2
indienick
Senior Member
 
Registered: Dec 2005
Location: London, ON, Canada
Distribution: Arch, Ubuntu, Slackware, OpenBSD, FreeBSD
Posts: 1,853

Rep: Reputation: 65
You can only run /usr/bin/authkey if its permissions mark it as executable.

Do the following at the command line:
(Remember "$" indicates a user prompt, "#" indicates the super-user prompt)
Code:
$ su
Password: (enter root password)
# chmod a+x /usr/bin/authkey
#


EDIT: Keep in mind, not all files can be executed once their permissions have been changed. Some files are not necessarily programs - it could just be a plain text file, in which case even if you make it executable, you won't be able to run it.

Last edited by indienick; 12-09-2006 at 11:18 PM.
 
Old 12-09-2006, 10:16 PM   #3
wmakowski
Member
 
Registered: Oct 2003
Location: Ohio
Distribution: Fedora 23, 24, RHL 5.2
Posts: 560

Rep: Reputation: 56
This sounds more like a $PATH issue than permission denied. Post the output of echo $PATH. It would also be interesting to see ls /usr/bin/auth*. Is it possible you are running a restricted shell?

Bill

Last edited by wmakowski; 12-09-2006 at 10:19 PM.
 
Old 12-09-2006, 11:21 PM   #4
indienick
Senior Member
 
Registered: Dec 2005
Location: London, ON, Canada
Distribution: Arch, Ubuntu, Slackware, OpenBSD, FreeBSD
Posts: 1,853

Rep: Reputation: 65
Most programs are installed to /usr/bin, and 99% of the distros out there have /usr/bin in the users' PATH env. variable - so I don't see that being an issue. But it's always worth a shot.
 
Old 12-09-2006, 11:57 PM   #5
zetabill
Member
 
Registered: Oct 2005
Location: Rhode Island, USA
Distribution: Slackware, Xubuntu
Posts: 348

Rep: Reputation: 31
Quote:
Originally Posted by wmakowski
This sounds more like a $PATH issue than permission denied. Post the output of echo $PATH. It would also be interesting to see ls /usr/bin/auth*. Is it possible you are running a restricted shell?

Bill
I think though, from the "No such file or directory" error, that /usr/bin/authkey were typed at the prompt rather than just authkey. If authkey were typed at the prompt and /usr/bin were not in $PATH or authkey is not in /usr/bin, then the error returned by bash would be "Command not found."

So either the command was typed incorrectly, the file is not executable, or the shell is somehow restricted. I think that authkey probably isn't in /usr/bin.
Code:
which authkey
will tell if authkey is executable from $PATH. If it isn't then find / -name authkey -print as root to see where it is on the system.
 
Old 12-10-2006, 07:43 AM   #6
xface66
LQ Newbie
 
Registered: Dec 2006
Posts: 29

Original Poster
Rep: Reputation: 15
i am running in su mode and i have done all u said.
it is on the PATH i know here are the results of your advices.

linux:~ # ls /usr/bin/auth*
/usr/bin/authkey


linux:~ # ls /usr/bin/auth*
/usr/bin/authkey


u see it is on the path but it gives no such file or directory errror

linux:~ # authkey
-bash: /usr/bin/authkey: No such file or directory

where is the problem?
 
Old 12-10-2006, 11:33 AM   #7
wmakowski
Member
 
Registered: Oct 2003
Location: Ohio
Distribution: Fedora 23, 24, RHL 5.2
Posts: 560

Rep: Reputation: 56
I think I know what it might be. Is /usr/bin/authkey a symbolic link? The link could be there, but the actual file it is pointing to is missing. Try ls -al /usr/bin/authkey, and see what you get.
Code:
[root@peanut root]# ls -al /usr/bin/hello
lrwxrwxrwx  1 root root 11 Dec 10 11:20 /usr/bin/hello -> /root/hello
Then follow the link to see if that file is there. In the above case, the link /usr/bin/hello points to /root/hello. When I remove /root/hello and leave the /usr/bin/hello link I get the same message.

[root@peanut root]# hello
-bash: /usr/bin/hello: No such file or directory


Bill

Last edited by wmakowski; 12-10-2006 at 11:41 AM.
 
Old 12-10-2006, 01:27 PM   #8
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 7,151

Rep: Reputation: 2203Reputation: 2203Reputation: 2203Reputation: 2203Reputation: 2203Reputation: 2203Reputation: 2203Reputation: 2203Reputation: 2203Reputation: 2203Reputation: 2203
The which command will search the $PATH to find out which file (if any) will qualify as a command.

Enter: which authkey.

The command will tell you if a qualifying file exists. If not, there is a $PATH issue. If so, there's an execute-permission issue.

Also note (as an aside): if the file you wish to run is in your current directory, Linux/Unix normally does not include that directory in your path. You must prefix it with ".'" to run it. ("." is a reference to "the current directory.") This is done so that you must explicitly (and therefore, presumably, knowingly and intentionally) request to run any program that is "right here," lest someone slip a program into a directory in hope that you will accidentally run it instead of the command you intended to use.
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
file not found by glob? - file exists? rgdatit Linux - Newbie 2 07-29-2005 03:16 AM
SIOCADDRT: File exists SIOCCADDRT: File Exists Failed to bring up eth0. opsraja Linux - Networking 0 01-10-2005 09:29 AM
Linker problem: can't find a file, but the file exists atlep Programming 5 08-16-2004 07:15 AM
File already exists mickstaff Programming 3 05-13-2004 04:34 AM
file exists? raven Programming 7 10-26-2003 08:44 AM


All times are GMT -5. The time now is 10:29 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration