LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-17-2014, 12:27 PM   #1
muruganvvm
LQ Newbie
 
Registered: Aug 2014
Posts: 1

Rep: Reputation: Disabled
Port Numbers in Linux


I am in need of the port numbers and the services available in Linux. How to disable a particular port if not needed. How to restart the same port when needed?
 
Old 09-17-2014, 12:53 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 17,926

Rep: Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690
Quote:
Originally Posted by muruganvvm View Post
I am in need of the port numbers and the services available in Linux. How to disable a particular port if not needed. How to restart the same port when needed?
  1. There isn't a list of ports for Linux. There is an IANA list of DEFAULT ports for services you can find in many places on the Internet, but those are just defaults/recommendations. You can configure most services to run on any port you'd like.
  2. You don't disable a port...you disable the SERVICE that is LISTENING on that port.
  3. You don't restart a port...you restart the SERVICE that LISTENS on that port.
For example, you can configure SSH to listen on port 8422 if you'd like..providing nothing ELSE is using that port. To 'disable that port', you would shut down SSH. To 'restart the port', you would START SSH. You can type in "cat /etc/services" and get a general list, but there is NO GUARANTEE that the services mentioned in that file are either running at ALL, or configured to listen on the ports mentioned in that file.
 
Old 09-17-2014, 01:01 PM   #3
salasi
Senior Member
 
Registered: Jul 2007
Location: Directly above centre of the earth, UK
Distribution: SuSE, plus some hopping
Posts: 4,052

Rep: Reputation: 881Reputation: 881Reputation: 881Reputation: 881Reputation: 881Reputation: 881Reputation: 881
You can find port number in /etc/services, although they may not be right if you have altered them (common practice with ssh, for example, and some services will re-use ports nominally allocated to something else).

You can't really disable a port, but you can block all traffic to it using iptables. To stop the block, you have to undo what you did to block it (remove the rule).

If you are using iptables, you might be better advised to go about it in a different way, depending on the numbers. The alternative approach is to drop everything, with the exception of the things that you know that you want to allow.
 
  


Reply


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
Port numbers in Solaris haripy Solaris / OpenSolaris 3 07-18-2013 01:20 PM
Port numbers? diegoandresalvarez Linux - Newbie 2 11-21-2007 08:23 AM
Where are printer port numbers?!? mentalken Linux - Hardware 3 01-27-2005 09:10 PM
need help with port numbers. GEEF Linux - Networking 2 11-08-2004 08:07 PM


All times are GMT -5. The time now is 06:55 AM.

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