bash scripts not working

I have just installed the latest Linux Mint 64 bit and have just found that bash scripting no longer works, so tried a simple script;
uname -a
Linux mint 2.6.35-22-generic #35-Ubuntu SMP Sat Oct 16 20:45:36 UTC 2010 x86_64 GNU/Linux
e.g.

vi hello

#!/bin/bash
echo “Hello World”

chmod +x hello

./hello
bash: ./hello: Permission denied

It even fails as root

Interestingly is that I have just tried it on another system using the same build and it works fine.

Any suggestions?

Where is the hello script located ?

if it’s outside your home directory you’ll have to chmod +x it with root permission

sudo chmod +x /path/to/sript/hello

and run it with root permission

cd /path/to/script
sudo ./hello

if hello IS in your home directory… you might want to check who owns the script

ls -l hello

will give you an output like:

-rwxr–r-- 1 mark mark 31 2010-11-04 13:26 hello

where mark mark is owner group

Thanks, guys.
I am using the script in my home directory and it belongs to me.

I believe that I have located the problem. it is the way that I am mounting my home directory disk.

i.e. (as root)
./hello fails when it exists in my home directory folder but if I move the file down to the root folder it then it works.

typing mount reveals;
/dev/sdc1 on /home type ext3 (rw,noexec,nosuid,nodev,commit=0)

so fstab entry for the disk is wrong, it appears that noexec and nosuid are added by default.

So what is the line for sdc1 (/home) in your /etc/fstab ?

just for comparison, here’s mine:
UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx /home ext3 defaults 0 2

obviously the UUID has been replaced with x’s, as I couldn’t be bothered to write it :wink:

Thanks Mark.

Problem solved.

My previous settings (the problem one) was;
/dev/sdc1 /home ext3 rw,user 0 0
which I have now changed to
/dev/sdc1 /home ext3 rw 0 0

Everything works now and the command mount reveals;
/dev/sdc1 on /home type ext3 (rw,commit=0)

No problem (not that I did anything), glad you solved your problem though… :slight_smile: