Commands for viewing ports on Linux:
Type 1: lsof-i: port number.
The second type: netstat-nltp|grep port number.
-a: Displays all connection ports and listening ports of this machine.
-n: The form of network IP address, which shows the currently established valid connections and ports.
-r: display routing table information
-s: Display statistics by protocol.
-v: Displays the currently valid connections.
-t: display all TCP protocol connections.
-u: Show all UDP protocol connections.
-i: Displays the status of the auto-configuration port.
-l: Only the service network status with the connection status of monitoring is displayed.
-p: display pid/programname.
What is the purpose of port 22?
Port 22 is an ssh port, and PcAnywhere may establish a connection between TCP and this port to find ssh. This service has many weaknesses. If configured in a specific mode, many versions that use the RSAREF library have many loopholes. (It is recommended to run ssh on other ports).
This service has many weaknesses. If configured in a specific mode, many versions that use the RSAREF library have many loopholes. (It is recommended to run ssh on other ports.)
It should also be noted that the ssh toolkit comes with a program called make-ssh-known-hosts. It scans ssh hosts throughout the domain. Sometimes you are inadvertently scanned by people who use this program.
The tool for connecting linux22 ports is SSHSecureShell. The premise is that iptable has opened ssh service.
How to disable high-risk ports in linux system?
The following summarizes three ways to close linux system ports for sharing.
1. Close the port by terminating the process.
Each port has a daemon, just kill this daemon.
Each port is occupied by a process,
The first step is to use the following command.
Netstat-anp|grep port
Find out the process that occupies this port,
Step 2, use the following command
kill-9PID
Kill it.
2. Open/close the port by opening and closing the service.
Because each port has a corresponding service, to close the port, just close the corresponding service.
Services that start automatically in linux are usually stored in two places:
Services under the /etc/init.d/ folder:
Services in this folder can be started or shut down by running the corresponding scripts.
For example: start the sendmail service:. /sendmailstart (TCP25 port is open).
Shut down the sendmail service:. /sendmailstop (close TCP25 port)
View the current status of the sendmail service:. /sendmail? Status (to see if the service is running)
Services under the /etc/xinetd.d/ folder:
The service in this folder needs to change the configuration file of the service and restart xinetd.
For example, to start the auth service, open the /etc/xinetd.d/auth configuration file, change "disable=no", save and exit.
Run /etc/rc.d/init.d/xinetdrestart.
To stop the auth service, please open the /etc/xinetd.d/auth configuration file, change "disable=yes", save and exit.
Run /etc/rc.d/init.d/xinetdrestart.
3. Restrict ports through firewalls
The method described below is very simple to use under Linux command.
Open ports are:
iptables-AINPUT-p$port-jACCEPT
Just change ACCEPT to DROP, that is:
iptables-AINPUT-p$port-jDROP
Where $port is the port number,
What is the application corresponding to linux54 port?
Familiar with port number: 0~ 1023. Each port is suitable for a specific application protocol.
Dynamic port number: 1024~65535 The client is assigned to each application process.
tcp(6):
FTP data (20)
FTP control (2 1)
Remote login (23)
Simple Mail Transfer Protocol SMTP(25)
HTTP(80)
POP3 (Electronic post office protocol) (1 1
UDP( 17)
Simple file transfer protocol TFTP(69)
Simple Network Management Protocol SNMP( 16 1)
DNS Domain Name System (80)-It is both tcp and udp.
How to view linux open ssh port?
See linux open ssh port specific steps are as follows:
1. First check whether the SSH package has been installed in linux, and use rpm-QA | grepsash.
2. Confirm that the ssh service has been started. Take centos system as an example.
3. The path to find the SSh service configuration file is usually the file sshd_config in the /etc/ssh directory. Note: SSH port defaults to 22. If you want to modify, edit port 22 directly. Please note that the preceding "#" should be deleted, then saved and restarted.