Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 07-31-2003, 01:27 AM   #1
LQ Newbie
Registered: Jul 2003
Posts: 6

Rep: Reputation: 0
how to close open ports

Can somebody help me with closing down ports. I used nmap localhost to find the open ports and this is the result.

Starting nmap V. 3.00 ( )
Interesting ports on localhost.localdomain (
(The 1598 ports scanned but not shown below are in state: closed)
Port State Service
111/tcp open sunrpc
631/tcp open ipp
6000/tcp open X11

Nmap run completed -- 1 IP address (1 host up) scanned in 1 second


well I went to services and stopped the services but the next time I restart, the services are back again. Anyone has idea what is going on and what I need to do.

Thanks in Advance.
Old 07-31-2003, 01:47 AM   #2
Registered: Oct 2001
Distribution: RH9 Kernel 2.4.20-18.9
Posts: 69

Rep: Reputation: 15
There are a number of things that you can do, but they depend largely on what installation and version of Linux you are using.

Furthermore, if you ran nmap from your machine, there is no guarntee that those ports are open to connections not originated from localhost, so it is possible (albeit unlikely) that no can connect to some of those ports unless they are already on your machine. For example, I get different results if I run "nmap localhost" vs "nmap" from another machine, but I have a physical firewall inbetween.

As for stopping the services: if you want them not to restart at boot-up or when changing init levels (if you do that) you'll have to edit the runlevel services. Again, if you want to do this using a GUI, you'll need to let us know which distribution of Linux you are using.

Additionally, I would suggest if at all possible, to set up a firewall like ipchains to run on your system. It's probably already there. If you can, I strongly recommend installing webmin so that you can easily manage this sort of stuff with a web-based GUI.

Lastly, if you want to try a quick fix, tryediting /etc/host.deny, make sure that there is only one uncommented line like so:


Then make sure that there are no uncommented lines in /etc/hosts.allow

On some systems, this will effectively turn off all ports. But it's not the best way to do it, especially if it's the only precaution you take.



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I close open ports ??? apache Linux - Security 2 07-20-2004 08:44 PM
Which ports should I keep open and which close?? apache Linux - Security 3 07-19-2004 09:31 AM
How do i close my open ports??? Synth218 Slackware 10 07-06-2003 03:31 PM
open ports... how do i close them? prodigius Linux - Security 3 01-18-2002 09:35 AM
how to close open ports zyan Linux - Security 3 08-04-2001 09:11 PM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 06:29 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration