August 13, 2011

Close any Port in Linux by Its Port Number

Command  To View The List of Open Port in Linux:

nmap localhost


nmap <Your IP>

After this you may find the result something like this:

25/tcp     open       smtp
80/tcp     open       http
111/tcp   open       rpcbind
113/tcp   open       auth

Note down the port number which is unnecessarily opened.

Now once we know which port is open we need to close the unnecessary port.

To Close the Port Type the Following Command:

fuser -k  <port no>

For example, in my case to close http port having port no 80 we have to type

fuser -k  80/tcp

This will close port 80 which is used by web server.

Note: You should have administrative privilege to use these commands.

No comments:

Post a Comment