Home > Articles > How to automatic close port using cron in linux

How to automatic close port using cron in linux

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
Tags: , ,
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: