Please follow the steps listed below as-is
Find, the line line which states 'Port 22'. Make sure that you pick a port which is currently not used on the system.
Change it to reflect the following and replace
Port <SSH port Here>
Save the file and then,
service sshd restart
Next time you wish to SSH into your VPS/Server you'll have to select the port you set it to,
ssh firstname.lastname@example.org -p <SSH port Here>
You can change the number "22" in the commands listed below to the new port you've set above and then run the command.
Used primarily on Ubuntu based systems
ufw allow 22
firewalld is primarily used on CentOS 7
firewall-cmd --zone=public --add-port=22/tcp --permanent firewall-cmd --reload
Most commonly used firewall on most systems (CentOS 6, Debian)
iptables -A INPUT -p tcp -m tcp --dport 22 -j ACCEPT service iptables save service iptables reload