Friday, October 29, 2010

Stopping Ping Replies

Hi Guys,

I have a new trick for you. I recently read saw somewhere on the net a trick to stop ping replies from a server but i found it a long and complex because i can do that in just one line.
I mean when we ping a server using its name or IP it give replies to us. For example: when i ping 4.2.2.2 i get result as:

PING 4.2.2.2 (4.2.2.2) 56(84) bytes of data.
64 bytes from 4.2.2.2: icmp_seq=1 ttl=53 time=288 ms
64 bytes from 4.2.2.2: icmp_seq=2 ttl=53 time=287 ms
.....so on

So we can stop these replies from our server just by editing permissions of the ping command.

Check the permissions of the command ping by the following command:

# ll /bin/ping
It will return results something like:
-rwsr-xr-x. 1 root root 42008 Mar  5  2010 /bin/ping

Now, As we can see that it has the sticky bit for the user ("s" in the permission). This helps to run the command as a root at the execution time.

To stop replies just remove this sticky bit from the permission and you are done.
# chmod u-s /bin/ping

Now, Your server won't reply to the pings.

No comments:

Post a Comment