+++
title= "Linux Change SSH Port Tutorial"
date= "2023-04-01"
+++
Change SSH Port on Linux#
- Modify sshd_config file
vim /etc/ssh/sshd_config
Edit the following: Port 10022
2. Restart sshd service
systemctl restart sshd
- Check port information
netstat -atunlp | grep sshd
- Add port 10022 to the firewall open port list
Add the port:
firewall-cmd --zone=public --add-port="10022"/tcp --permanent
Persist the configuration of port 10022 in the open port list.
6. Reload the firewall
Command:
firewall-cmd --reload
Explanation: Reload the firewall to apply the latest configuration.
7. Check the firewall status of the open port
Command:
firewall-cmd --permanent --query-port="10022"/tcp
Explanation: Check the firewall status of the open port.
8. View the list of open ports in the firewall
Command:
firewall-cmd --zone=public --list-ports
Explanation: View the list of open ports in the firewall.
9. Connect to the server using Xshell client
After confirming the port modification and firewall opening, you can use tools like Xshell to connect to the server.