banner
xingli

xingli

猫娘爱好者

Change SSH port in Linux

Change SSH Port in Linux#

  1. Modify the sshd_config configuration file
vim /etc/ssh/sshd_config

Content to be modified: Port 10022

  1. Restart the sshd service
systemctl restart sshd
  1. Check the port information
netstat -atunlp | grep sshd
  1. Add port 10022 to the open port list of the firewall

Add port:

firewall-cmd --zone=public --add-port="10022"/tcp --permanent

Persistently configure port 10022 in the open port list.

  1. Reload the firewall

Command:

firewall-cmd --reload

Explanation: Reload the firewall to apply the latest configuration.

  1. Check the firewall's allow status for the port

Command:

firewall-cmd --permanent --query-port="10022"/tcp

Explanation: Check if the firewall has allowed the port.

  1. View the list of ports allowed by the firewall

Command:

firewall-cmd --zone=public --list-ports

Explanation: View the list of ports allowed by the firewall.

  1. Connect to the server using Xshell client

After confirming the port modification and opening the firewall, you can use Xshell or other client tools to connect to the server.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.