In daily work, for the sake of security, we often modify the default ssh port to 22 by default. first, enter the sshd service configuration file vi/etc/ssh/sshd_config like centos5/6. # Remove Port22 # Remove 22. change it to Port2000 and save it.
In daily work, we often modify the default ssh port 22 for security reasons.
First, enter the sshd service configuration file like centos5/6.
-
Vi/etc/ssh/sshd_config
Find # Port 22 to remove # Change 22 to what you want, and change it to Port 2000 and save it.
2. restart the sshd service.
Systemctl restart sshd. service
3. semanage port-a-t ssh_port_t-p tcp 3333
Add Port 2000 to SELinux
Systemctl status sshd. service to view the sshd service port status
4. disable the selinux service
Test telnet [ip] [port] on the remote host.
Ssh test@192.168.100.100-p 2000
Test@192.168.100.100's password:
Enter the password to access