Archive

Posts Tagged ‘port’

How to automatic close port using cron in linux

March 2, 2011 Leave a comment

In this article I would like to share about how to close ports on linux automatically. This was started because of the specific ports that run without my willingness. We just need to schedule a cron job to do that, and then just monitors to see whether our script run as we will or not. The following scripts are used:

[root@localhost ~]# lsof -i:22
[root@localhost ~]# crontab -e
*/3   *  *  *  *  /sbin/fuser -k 22/tcp
[root@localhost ~]# tail -f /var/log/cron
Advertisements
Tags: , ,
%d bloggers like this: