Why Can't My Linux VPS SSH?

There are several things to consider why your Linux VPS is not SSH accessible. But the majority of the problem is usually the firewall.


Firewall di Centos


The main problem that may arise is the firewall in Centos 7.x where there is a new feature called firewalld which is active by default.


To fix this, you can add custom ports via firewalld or enable firewalld. If you want to add a custom port to firewalld then :


firewall-cmd --zone=public --permanent --add-port=5000/tcp

firewall-cmd --reload

and so on. Where 5000 is your custom port.

Make sure the ssh config in /etc/ssh/sshd_config has been updated to the new port.


Meanwhile, to turn off the feature:

service firewalld stop

chkconfig off firewalld


Thus the firewalld service will be stopped and after rebooting the service will no longer run.


Firewall di Ubuntu


The main problem that usually arises is the ufw firewall on Ubuntu versions 16.x and above. We can add custom ports or turn off the firewall service.



If you want to add a port :

ufw allow 666/tcp

Where 666 is your custom port.

Make sure the ssh config in /etc/ssh/sshd_config has been updated to the new port.


Meanwhile, if you want to turn it off, then :

service ufw stop

chkconfig off ufw

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.