Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Security
User Name
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.


  Search this Thread
Old 05-02-2001, 06:47 PM   #1
LQ Newbie
Registered: Apr 2001
Location: Washington State
Posts: 7

Rep: Reputation: 0

I have Redhat for dummies.... I.E. Me..
I want to create a firewall, and in the book that came with my redhat, it just makes statements that I don't understand.

It says... "Create a script called, "ipfilter.eth0" in the /usr/local/etc directory" ???????? HOW.....
and also.. do I type the symbol "#" when I type the lines???

any help would be great.. thanks
Old 05-03-2001, 04:56 AM   #2
Registered: Apr 2001
Location: London
Posts: 408

Rep: Reputation: 31
Like DOS you can create batch files in Linux called scripts.
But due to the permissions you have to tell the file its an executable.

to create and empty script file in Linux type this:
# (this is the prompt you should have when your root)
$ su - root
# echo '#!/bin/sh' > /usr/local/etc/ipfilter.eth0

this has made the start of a shell script in the directory you said.

now you have to tell the system you want it executable.

# chmod 700 /usr/local/etc/ipfilter.eth0

Now you just have to learn how to write shell scripts and run the file with your program in it.

Old 01-04-2002, 08:46 AM   #3
LQ Newbie
Registered: Jan 2002
Posts: 1

Rep: Reputation: 0
Question Here's what I didn't understand...

This is what I did, not sure what to make of it:

1) Copied the files ipfilter.rules and ipfilter.release from CD3 into the /usr/local/etc/ directory

2) Did a search and replace for ppp0 to eth0 on ipfilter.rules

3) Saved ipfilter.rules as ipfilter.eth0

4) Did a chmod 770 /usr/local/etc/ipfilter.*

5) Tried to execute the ipfilter.eth0 file, with no joy. Tried again, rinse, lather, repeat, no joy.

6) Read this post

7) Deleted both files, and did the "# echo '#!/bin/sh' > /usr/local/etc/ipfilter.eth0" command, which created the new ipfilter.eth0 file

8) Opened the file from the CD, copied the contents, and pasted it into the new ipfilter.eth0 file. Searched, Replaced, Saved. Did the same steps to create and past into the ipfilter.release.

9) Did the same chmod command, chmod 770 /usr/local/etc/ipfilter.*

10) They executed and worked as designed

Here's my question... why did the file(s) on the CD not execute after the chmod, but when I first created the file locally then pasted the same contents, it worked w/o a problem?

Thanks! Newbie here
Old 01-04-2002, 08:58 AM   #4
Senior Member
Registered: Dec 2001
Location: The Netherlands
Distribution: Ubuntu
Posts: 1,316

Rep: Reputation: 47
As far as I can see the second time you added the first line, which said '#!/bin/sh'. This line the shell which program should run the script. If you don't include that file it won't run unless you specifically tell it to run with that program. Like 'sh scriptfile'.
Old 01-04-2002, 09:46 AM   #5
Registered: Oct 2001
Distribution: MD81 RH71
Posts: 555

Rep: Reputation: 30
well, you don't HAVE to specify the shell to run it in. if you don't include #!/bin/sh then it'll just drop the commands to the chell you are currently using, e.g. bash or sh. you have to specify perl or awk tho, as those commands mean nothign to sh
Old 01-08-2002, 10:22 AM   #6
Registered: Dec 2001
Location: /mnt/UNV/Mlkway/Earth/USA/California/Silicon Valley
Distribution: Kubuntu, Debian Wheezy/Jessie Stable, Windoze 7
Posts: 596

Rep: Reputation: 36
Thanks, you saved my day!

I had the same problem, a script that just would not run.

Your post was really helpful, thanks!!!

Keep up the great spirit, Linux is getting into my heart more and more!!! ;-)




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
help with writing a script jedimastermopar Linux - General 10 05-02-2005 02:34 PM
help writing script willinusf Programming 7 07-20-2004 12:37 PM
Help writing a rm script VisionZ Linux - Newbie 17 03-24-2004 08:15 AM
Help Writing a script. teeth44 Programming 2 10-14-2003 01:00 PM
Writing a Script Nyc0n Linux - General 2 05-27-2002 08:21 PM > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 07:20 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