1827876 Members
1466 Online
109969 Solutions
New Discussion

Problem executing files

 
Admin32
Advisor

Problem executing files

Hi everyone,

I've got a somewhat interesting problem with a Linux Redhat 7 workstation.

The user has created a simple script that will print 'Hello World' on the screen once executed.

The file permission are set to 777 and once executed we get the following error:
bash: ./hello: Permission denied

So I logged in as root, and the results were the same. We tried creating another small and simple script and the problem persists... so I moved the file to another workstation to see if it would run, and it did - without any errors.

I've checked the passwd file to see if there was anything fishy going on with the groups the user was part of, but i couldnt find any problem.

Does anyone have any ideas ? Is it possible to remove executable permissions on a file system regardless if the 'X' flag is set on specific files ?

Any thoughts or ideas are appreciated.

Chris P.
7 REPLIES 7
Sergejs Svitnevs
Honored Contributor

Re: Problem executing files

Do you make sure bash is executeable?

Error "bash: ./hello: Permission denied " can be translated as :
bash: In the command: ./hello could not execute the interpreter /bin/sh. Reason: Permission denied.

Try: ldd /bin/bash

Check that you have got execute permission for all of the libraries.

Regards,
Sergejs
Chris Vail
Honored Contributor

Re: Problem executing files

You should check the permissions also of the . and the .. directories too.



Chris
Jairo Campana
Trusted Contributor

Re: Problem executing files

add in firts line of you script, that is everything for each case if you use
#!/bin/bash
or
#!/bin/sh
or
#!/bin/ksh

that is everything
legionx
Stuart Browne
Honored Contributor

Re: Problem executing files

I don't suppose you could post us the contents of this 'hello world' script?

As you've neglected to even say what the script's name is, all of our responses are going to have a certain amount of guess work in them.

Here's my guess work..

The line that is supposed to print "hello world" has the two words 'hello' and 'world' on it, and that's all, yes?

In order to print to the screen from a shell script, you need to use the command 'echo'. So to 'print' hello world to the screen from a scrpt, you'd need a line like:

echo hello world

One long-haired git at your service...
Balaji N
Honored Contributor

Re: Problem executing files

hi,
i guess there is some thing simple which you are overlooking.

1. can u do a ll -d on the directory and post the output.
2. can u post the script hello.
3. can u tell the location of bash (which bash)

-balaji
Its Always Important To Know, What People Think Of You. Then, Of Course, You Surprise Them By Giving More.
Balaji N
Honored Contributor

Re: Problem executing files

hi,
i guess there is some thing simple which you are overlooking.

1. can u do a ll -d on the directory and post the output.
2. can u post the script hello.
3. can u tell the location of bash (which bash)

-balaji
Its Always Important To Know, What People Think Of You. Then, Of Course, You Surprise Them By Giving More.
Tibor Bajnok
Occasional Advisor

Re: Problem executing files

You could start this script with "strace".
Perhaps it will produce some useful debug info.