Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 01-18-2004, 10:46 PM   #1
Registered: Jan 2004
Location: EST
Distribution: Slackware 10.0
Posts: 150

Rep: Reputation: 15
Error trying to execute shellcode

Ive been following a tutorial and Ive come to a part about writing and executing shellcode. It told me to create a file called, and then to run the command "chmod 0755". I did this, and it appeared to work; it turned the file name green when I view it with the ls command. Well, anyway, it then told me to open it up and write a few shell script commands into it just to basically get the hang of executing these files. So I wrote a simple shell script, just echoing some things, and then I saved it. Well, when I tried to run it via "./" it gave me the following error:

-bash: ./ bin/sh: bad interpreter: No such file or directory

The no such file or directory part didnt seem to make much sense to me, because I can see that the file IS there. I also tried making another file and doing the exact same thing but without the chmod part. That gave me a "Permission denied" error message. I then thought that maybe I didnt have sufficient permission on this account, so I switched to root and tried again and got the same results. I have tried everything I can think of, but maybe its something that should be obvious. I have only had linux a few days, so Im still learning.

If anyone can help me out with this, Id really appreciate it. Until then Ill just skip over this part of the tutorial. Thanks.
Old 01-18-2004, 10:50 PM   #2
Senior Member
Registered: Nov 2002
Location: pikes peak
Distribution: Slackware, LFS
Posts: 2,577

Rep: Reputation: 48
/bin/sh should be just a symlink to /bin/bash
also make sure /bin/sh is in your $PATH
Old 01-19-2004, 12:15 PM   #3
Registered: Jan 2004
Location: EST
Distribution: Slackware 10.0
Posts: 150

Original Poster
Rep: Reputation: 15
/bin/sh is in my path, Im still getting the error though. Any other ideas?
Old 01-19-2004, 12:18 PM   #4
Senior Member
Registered: May 2003
Location: Malaysia
Distribution: Slackware, LFS, CentOS
Posts: 1,307

Rep: Reputation: 46
Make sure your shebang is correct... ie, the first line of your script should be:
Substiture /bin/bash with whatever shell you normally use.

It seems that you missed a slash somewhere
Old 01-19-2004, 12:33 PM   #5
Registered: Sep 2003
Location: Canada
Distribution: Fedora 25
Posts: 340

Rep: Reputation: 36
Like Azmeen said:

What is the first line in ./configure? That's what bash is complaining about.

Can you run any shell script?
Old 01-19-2004, 12:51 PM   #6
Registered: Jan 2004
Location: EST
Distribution: Slackware 10.0
Posts: 150

Original Poster
Rep: Reputation: 15
Ah, we have a winner... my script origionally was just this:

echo "Hello there!"

But now I changed it to

echo "Hello there!"

And it works perfectly fine... now I can continue with this tutorial. Thanks for the help, I was definitely looking for this problem in the wrong place.
Old 01-28-2004, 01:46 PM   #7
LQ Newbie
Registered: Jan 2004
Location: GMT -7 (MST)
Distribution: SuSE 10
Posts: 1

Rep: Reputation: 0

I had a similar problem but the solution for me was different. I was going through the script tutorial on my Windows workstation and had copied and pasted the "Hello World" script into my windows text editor and then SSH'd the script to my Linux box. I was getting the same "bad interpreter" error unitil I opened the script again in a linux editor and resaved it. It turns out that linux uses a different end of file marker than DOS/Windows and the script would not run until it had been corrected for linux.
You can also use: dos2unix < oldfile > newfile
to convert the dos/windows file to a valid linux file.


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
snort - SHELLCODE x86 NOOP ddaas Linux - Security 7 06-17-2005 11:15 AM
shellcode for remote bf Ephracis Linux - Security 3 06-04-2005 12:10 PM
Shellcode question invisibleghost Programming 3 11-08-2004 08:02 PM
error cannot execute /etc/rc.d/rc 4 BM Fan Linux - General 2 09-11-2004 07:10 AM
shellcode question korbin Linux - Newbie 1 01-11-2004 04:48 AM > Forums > Linux Forums > Linux - Newbie

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

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