Tuesday, April 26, 2011

Which ports is my Linux computer / Server listening to?

Introduction

Security, always a concern in these days, yes, it may be your house, your car even yourself, we are all in danger, and so are our servers and computers.

Well, to protect you Linux computer you can take a lot of actions, and one of them is to know which ports is your Linux listening to, this way if some of them are not needed you can shut the service down.

Which ports is my Linux listening to?

We’ll use netstat to find out which ports is our computer listening to.

netstat -t --listening
The output could look like this:

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 *:x11 *:* LISTEN
tcp 0 0 *:ssh *:* LISTEN
tcp 0 0 *:ipp *:* LISTEN
tcp 0 0 *:microsoft-ds *:* LISTEN
tcp 0 0 *:netbios-ssn *:* LISTEN
tcp 0 0 *:x11 *:* LISTEN
tcp 0 0 *:ipp *:* LISTEN
That is the example of my office computer, your output may change, and if it is a public server, you should have a lot less ports opened.

No comments: