LinuxQuestions.org
Visit Jeremy's Blog.
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 05-14-2006, 02:29 PM   #1
Lotharster
Member
 
Registered: Nov 2005
Posts: 144

Rep: Reputation: 18
executing script with ./ does not work


I wrote a script:
Code:
#!/bin/bash
echo Hello world
when I try to execute it via ./hello, it does not work:
Code:
me@mymachine:~$ ./hello
bash: ./hello: /bin/bash: bad interpreter: Permission denied
me@mymachine:~$ ls -l|grep hello
-rwxr-xr-x  1 lo lo   29 May 14 21:38 hello
I set the right permissions, so what is wrong?

Lotharster
 
Old 05-14-2006, 02:40 PM   #2
TigerOC
Senior Member
 
Registered: Jan 2003
Location: Devon, UK
Distribution: Debian Etc/kernel 2.6.18-4K7
Posts: 2,380

Rep: Reputation: 49
Go to the directory where the script is located and do chmod 700 ./hello
 
Old 05-14-2006, 02:52 PM   #3
BCarey
Senior Member
 
Registered: Oct 2005
Location: New Mexico
Distribution: Slackware
Posts: 1,613

Rep: Reputation: Disabled
You do not have permission to run bash? Try to check the permissions of bash and chmod as necessary.

Brian

Last edited by BCarey; 05-14-2006 at 02:57 PM.
 
Old 05-14-2006, 03:07 PM   #4
Lotharster
Member
 
Registered: Nov 2005
Posts: 144

Original Poster
Rep: Reputation: 18
Quote:
Originally Posted by BCarey
You do not have permission to run bash? Try to check the permissions of bash and chmod as necessary.
Brian
The bash permissions are:
Code:
-rwxr-xr-x  1 root root 611K Dec 19  2004 /bin/bash
So that should be OK ?

Lotharster
 
Old 05-14-2006, 04:02 PM   #5
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,284

Rep: Reputation: 371Reputation: 371Reputation: 371Reputation: 371
Very odd -- perhaps you wrote the script on a partition that's been mounted with the noexec flag? Check with the mount command or try moving the hello script to another directory (on a different partition)and run it again. it would help if you told us which distro and version you are using.
 
Old 05-14-2006, 04:53 PM   #6
Lotharster
Member
 
Registered: Nov 2005
Posts: 144

Original Poster
Rep: Reputation: 18
Quote:
Originally Posted by btmiller
(...) perhaps you wrote the script on a partition that's been mounted with the noexec flag? (...)
I tried moving the script to my $HOME directory, and it worked there. How can i set/unset the noexec flag?
This is the fstab entry of the partition. (It is a loop-aes-encrypted partion.)
Code:
/dev/hda7       /mnt/crypted    ext3    defaults,user,noauto,loop=/dev/loop0,encryption=aes128,itercountk=1000  0       0
 
Old 05-14-2006, 05:13 PM   #7
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,284

Rep: Reputation: 371Reputation: 371Reputation: 371Reputation: 371
Hmmm ... I don't see noexec in the fstab options. Maybe it's a side effect of it being an encrypted partition. I did a quick Google and didn't find anything relevant. I tried it on a normal, unencrypted loop filesystem and it worked fine. Unfortunately I don't have the necessary encryption built into my kernel to try that.
 
Old 05-14-2006, 05:27 PM   #8
BCarey
Senior Member
 
Registered: Oct 2005
Location: New Mexico
Distribution: Slackware
Posts: 1,613

Rep: Reputation: Disabled
What does "loop=/dev/loop0" do? Could this be the source of the permission problem? (My /dev/loop0 is set at 660.)

Also, will the script run as root?

Brian
 
  


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
Bash script - executing a script through subdirectories bubkus_jones Programming 5 04-24-2006 05:05 PM
executing a script - check.sh wfstanle Linux - Newbie 4 12-16-2005 08:14 AM
executing a script!! vishamr2000 Linux - Security 5 07-29-2005 02:34 AM
Executing install script for ... securehack Linux - Software 6 05-24-2005 11:02 AM
Script is not executing in Apache!!! linux_child001 Linux - Newbie 1 06-22-2004 05:10 AM


All times are GMT -5. The time now is 07:07 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration