LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 11-11-2015, 08:02 AM   #1
greenace92
Member
 
Registered: Nov 2015
Posts: 70

Rep: Reputation: Disabled
How to block all ports and then selectively enable ports? Key-authentication 22


When I use netstat to list ports, I don't see direct ports such as port 22, port 80, etc... I did see 80 but I also see a bunch of others with really high numbers like... well what is I-node?

From a page from my server provider I am told that by default these are the open ports: 21,22,23,25,53,80,110,143,443,10000 so I guess I don't have to block?

I'm just not sure really. I don't believe that I use SMTP, not yet anyway.

A secondary question is using key-based authentication of port 22, my concern is that I have a dynamic ip-address although I'm not sure if that is relevant. Does the 192. ip address change? Or is it only the public ip such as 72 which is what I see when I type in Google "What is my ip address"

Thanks for any help
 
Old 11-11-2015, 09:02 AM   #2
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Those ports may be "open" upstream from your service provider, but unless you are running services on those ports, they are closed.

What OS. etc... (you know, the usual questions?)

https://www.linuxquestions.org/quest...#faq_lqwelcome

wrt: open ports
Code:
lsof -i :<port>
to see what's using the port and has it open.

Last edited by Habitual; 11-11-2015 at 09:04 AM.
 
Old 11-11-2015, 09:09 AM   #3
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,803

Rep: Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306
I'm a bit confused. I do not really understand what do you want to know.
ports are usually protected by firewall. Ports are only opened if there is an app listening on it. That means there should be a program waiting for something on that port. Without apps nothing will listen, the ports will be closed. But using a firewall you can restrict if a port available at all.
You cannot set up any authentication on any port but on the listening application. 22 is usually used by sshd.

Your IP address is probably dynamic and depends on your router, but without knowing your config it is only a guess.
 
  


Reply



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
Is it possible to selectively disable USB ports in Linux? Leonid.I Linux - Hardware 2 10-18-2010 05:01 PM
Need to block all ports and open only select ports on Ubuntu 7.1 Mr.J Linux - Networking 1 11-18-2008 02:45 AM
DISCUSSION: Forward ports via an SSH tunnel with auto reconnect (using key pair authentication) merize147 LinuxAnswers Discussion 0 07-24-2006 04:31 PM
iptables selectively allowing ports through mrsteveman1 Linux - Networking 1 06-21-2006 09:50 AM
How do i enable ports? Tigger Linux - Networking 8 06-02-2003 02:24 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:31 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
Open Source Consulting | Domain Registration