4 Answers
4

Port 25 is, as your post already says, SMTP. This means there is a mailserver installed and listening to requests on your port 25. This is quite unusual on a desktop computer, propably happened accidentaly while installing another program that sends emails.

Port 631 is the port for CUPS, the printer driver software. This is quite usual as it comes with the default installation. If you configure your computer for sharing printers, port 631 will always be open to the other computers, so they can use the printer.

If you want to find out, which exact program is responsible for an open port, type:

sudo fuser -v 25/tcp

replacing 25 in the example with your desired port. This should tell you which program is running.

From then on, you have several possibilities. First, you can just uninstall the corresponding program, in this case the mailserver that's running. Second, if you want to keep the program, you could try just stopping the service, like so:

sudo stop exim4

Please note that YMMV here, as different programs use different filenames for their services and could be started in a totally different way.

Also, please note that scanning your computer from itself will reveal ports that are open only on localhost. Those are closed to the outside but need to be open to localhost, like Cups. This does not pose a security risk.

Stoping the service that way only disables it until the next restart. if you don't need a mailserver (exim4), you can just uninstall it. You don't need to disable cups if you plan on installing a printer later. However, if you want to, you could type sudo update-rc.d -f cups remove and to re-enable: sudo update-rc.d cups defaults
–
Florian HeinleDec 29 '10 at 20:34

which will block all inbound traffic by default. This gives peace of mind that if you install something that silently opens ports on your system (such as enabling network printing), then you're still protected generally.

Conversely, this will mean that you will install services, forget a firewall is running and wonder why nothing is working!