Debian 10 Check Open Ports

Ports are defined as the endpoints of communication that are required for two or more parties to communicate with each other via a network. Ideally, when two or more parties are communicating with each other, their respective ports should stay open. However, at times, even when a communication terminates, the ports could still stay open, which can give rise to various security concerns. Moreover, unnecessarily open ports can also consume extra resources. So you must keep a continuous check on all the open ports. Therefore, in this article, we will explain to you the different methods with which you can check the open ports in Debian 10.

Methods of Checking Open Ports in Debian 10:

For checking the open ports in Debian 10, you can make use of any of the four methods discussed in this article.

Method # 1:

To check open ports in Debian 10 by making use of the netstat command, you will need to perform the following steps:

1. First of all, you will need to launch the terminal. For doing that, click on the Activities tab located on your desktop, type terminal in the search bar that appears, and then click on the search result to launch the terminal in Debian 10. The newly launched terminal window is shown in the image below:

2. Now type the following command in your terminal and press the Enter key:

sudo apt-get install net-tools

Running this command will install the net-tools package, which is necessary for using the netstat command. This command is also shown in the following image:

3. After running this command, type the following command in your terminal and then press the Enter key:

netstat –pnltu

This command is shown in the image below:

4. As soon as this command executes successfully, a list of all the different ports along with their states will appear on your screen as shown in the following image:

Method # 2:

To check open ports in Debian 10 by making use of the ss command, you will need to perform the following steps:

1. Launch the terminal in the same way as described in the method above. Now type the following command in your terminal and then press the Enter key:

ss –lntup

This command is also shown in the image below:

2. As soon as this command executes successfully, a list of all the different ports along with their states will appear on your screen as shown in the following image:

Method # 3:

To check open ports in Debian 10 by making use of the nmap command, you will need to perform the following steps:

1. Launch the terminal in the same way as described in Method # 1. Now type the following command in your terminal and then press the Enter key:

sudo apt-get install nmap

Running this command will install the nmap utility after which we will be able to successfully use the nmap command. This command is also shown in the image below:

2. Now if you want to check all the open TCP ports, then type the following command in your terminal and then press the Enter key:

sudo nmap –sT –O localhost

This command is shown in the following image:

3. As soon as this command executes successfully, you will immediately be able to know if any TCP ports are open or not as shown in the image below:

4. However, if you want to check all the UDP ports that are open, then type the following command in your terminal and then press the Enter key:

sudo nmap –sU –O localhost

This command is also shown in the image below:

5. As soon as this command executes successfully, you will immediately be able to know if any UDP ports are open or not as shown in the following image:

Method # 4:

To check open ports in Debian 10 by making use of the lsof command, you will need to perform the following steps:

1. Launch the terminal in the same way as described in Method # 1. Now type the following command in your terminal and then press the Enter key:

sudo apt-get install lsof

Running this command will install the lsof utility after which we will be able to successfully use the lsof command. This command is also shown in the image below:

2. Now type the following command in your terminal and then press the Enter key:

sudo lsof –i

This command is shown in the following image:

3. As soon as this command executes successfully, a list of all the ports along with their status will appear on your screen as shown in the image below:

Conclusion:

By making use of any of the four methods discussed in this article, you can easily check all the open ports in Debian 10. The only point that is to be noted here is that the commands that are followed by the “sudo” keyword require root privileges. Therefore, you must run them as it is.



from Linux Hint https://ift.tt/2ZWZFnP

Post a Comment

0 Comments