How to Unbind Service From a Port in Your Linux Server
Linux services, also known as daemons, run on specific system ports and listen for network connections that come through them. Even system services that do not operate over the Internet may choose to install both a server component and a client component that requires a local port to be open. You will run into port issues if you try to run two services that require the same port to be used. You can determine which ports are in use using the built-in "lsof" command.
Instructions
-
-
1
Log into your Linux system using your user name and password.
-
2
Open a new terminal window. Each Linux operating system uses different settings, but the terminal is typically found in the "Utilities" or "Administrative Tools" window. Check your system's documentation for more information.
-
-
3
Type "sudo lsof -Pnl +M -i4" without quotation marks and press "Enter." Enter your root password when prompted and press "Enter" again.
-
4
Review the console's output. On the far-right column labeled "Name" is the local IP address and port. The port immediately follows the ":" symbol after the IP address. As an example, if the "Name" field reads "192.168.0.201:529" this means the service is running on port 529. Look to the far left of this row of the table below the "PID" column. This is the ID number of the process taking this port. To the left of "PID" is the "COMMAND" column, which helps you to identify what the process is. Record the PID of the process taking the port you want to free.
-
5
Type "sudo kill -9 <pid>" without quotation marks. Replace <pid> with the number taken from the "PID" column of the previous process list. This will forcefully terminate the process, thereby freeing up the port.
-
1