To block ip address

Hi,

I need to block a ip address without logging to the server not for a single server for more number of servers. I use the tool " apf" to block an ip

apf -d <Ipaddress>

Is this can be done with the shell script.?

Yes, of course.

Can I have the script to do this, please.. . I am not much familiar in shell scripting ...

What shell are you using?

bash shell

... and what do you want the script to do? what are the inputs and outputs required?

Once if I run the script, it should ask me for the ip address to be blocked.
And, When I enter the ip address, it should be get blocked in all the server that are listed in the script. Thats it nothing much...

OK, that is very easy.

I suggest you search the forums a bit and you will find many examples of similar code, then write you own script and post it. Folks will help you if you do the initial work.

I have already searched, but I could not able to find out any.... after then I posted ..

I think there are many many examples of code here that take an input argument and use that argument in the script.

You need to search more :smiley:

If you can't find it (maybe you are not good at keyword searches), you can search the net for a bash tutorial and at least attempt to write this very trivial script yourself first.

Then, post what you have written and folks will help you.

Ok Sure,, I will try and get up with the script...