Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
You don't really need to insert it anywhere. You could execute that script as a file of it's own an you'd be fine. But if you wanna insert it into your current iptables script then that's okay too. Anywhere in the script will work, as long as there are no -I rules after this which might conflict.
i have not understood... must i create a file with that script? how i can create it? and how execute it?
Yes, you could create a file for it if you want. You'd just need to edit the /etc/example.txt part in it to match whatever file you actually have the IPs stored in. You create it just like you would any other text file: Select the code I posted, right-click on it, select "Copy", open your favorite text editor, start a new file, right-click in it, select "Paste", edit the path/filename I just told you about, select "Save", type in the file name and path you wish to save the script as.
To make the file executable you right-click on the file, select "Properties" (or whatever), and tweak the permissions accordingly. You could also just use the chmod command on it like:
Code:
chmod 755 /etc/example.sh
To execute the file you just do a:
Code:
/etc/example.sh
BTW, I'm moving this thread to Newbie for better exposure.
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,233
Rep:
depends on what is broken, you could get a 'file not found error' if you input the wrong filename or a syntax error for iptables if the syntax were incorrect
the question is how do you know it isnt working?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.