You can easily change SSH Port number for SSH Connect. Using default port number (22) for SSH connection is too risky. Spammers, Hackers can attack your server using default port number. It is highly recommend to change SSH Port for your Linux VPS server.
Steps to change SSH Port on Linux
Step-1: Connect to your server via SSH.
Step-2: Switch to the root user if you have another user with sudo privileged.
Step-3: Edit sshd_config file to change your port. Run below command:
Step-4: Locate the following line: #Port 22 You can search for the line using /Port command
Step-5: Press i for insert mode and remove # and enter the port number as per your choice.
Step-6: Press ESC and :wq to save and close the file.
Step-7: Restart the sshd service by entering below command:
service sshd restart
Done! Now try to login with old port and you’ll see your server refusing the connection.