OVH Community

Welcome to your community space. Ask questions, search for information, post content, and interact with other OVH Community members.

Not able to connect to my server at all


Hi! I’m having some pretty frustrating issues, I’m not completely sure what/why this is happening, and I’m also not the best when it comes to this stuff, so I’m hoping maybe you guys can help!

Last night I was doing some tweaking and tried to open a port, I noticed that the port was saying it’s opening, but when I would run sudo netstat -tulpn | grep LISTENit wouldn’t show the port I just opened. After doing some searching I found that when running sudo ufw status it would return “Inactive” - after enabling it, I noticed that my ports we showing as open, so I closed my terminal. Fast forward a few hours, I’m not longer able to connect to my server via SSH or FTP. Every time I try to connect, I get a “Connect Timed Out” error - I opened a ticket and was told that my servers firewall was not configured. I took a look at it, but couldn’t seem to get any better results.

I’d appreciate any help on this, if you need anymore info, let me know!


Hi DylanL

As you stated:

sudo ufw status it would return “Inactive”

After that, you enabled the firewall using this command I suppose:

sudo ufw enable

you should have got this message but you continued:
Command may disrupt existing ssh connections. Proceed with operation (y|n)?
Firewall is active and enabled on system startup

What does that mean?
By default, UFW denies all incoming connections and allows all outgoing connections. It means that a client trying to reach our server would not be able to connect. When an application from our server tries to connect any other server outside, it will be allowed.

In other words, you locked yourself out from your VPS.

What you can do, This is the part why I love OVH.
Log in to your OVH account, from dashboard go to your VPS. On the home of your VPS you see the Shortcuts, go to KVM.

Type in your user name from your VPS, and then the password.
Here you can use any commands like in a normal terminal.

Now type in the following command:
sudo ufw allow ssh

Voila. You should be able to access now your VPS through ssh again.

To allow any other services in your firewall just type the command for example for http and https:
sudo ufw allow http
sudo ufw allow https

By default ufw it will allocate the port numbers what have been specified in /etc/services file configuration.

To specifically allocate a port number to a service you have just enabled, the port number has to be specified after the service was allowed:

sudo ufw allow ssh
sudo ufw allow 22

sudo ufw allow https
sudo ufw allow 443

sudo ufw allow http
sudo ufw allow 80

Hope this helps and you get it sorted out.