0

I have a machine installed in Google Cloud VM, I was making the SSH connection here without any problems, but when I wanted to log out and connect again, I started to get no results here.

I stay on the Could not connect, trying screen and when I look at the logs, the output of Updating keys for user and then [UFW BLOCK] catches my attention. Can you help me with this?

1

1 Answer 1

0

UFW (uncomplicated firewall) is a firewall configuration tool that runs on top of iptables, included by default within Ubuntu distributions. It provides a streamlined interface for configuring common firewall use cases via the command line.

By default, when enabled UFW will block external access to all ports on a server. In practice, that means if you are connected to a server via SSH and enable ufw before allowing access via the SSH port, you’ll be disconnected. Make sure you follow how to enable SSH access.

To see what is currently blocked or allowed, you may use the verbose parameter when running ufw status, as follows:

sudo ufw status

Allow SSH

When working with remote servers, you’ll want to make sure that the SSH port is open to connections so that you are able to log in to your server remotely.

The following command will enable the OpenSSH UFW application profile and allow all connections to the default SSH port on the server:

sudo ufw allow OpenSSH

Although less user-friendly, an alternative syntax is to specify the exact port number of the SSH service, which is typically set to 22 by default:

sudo ufw allow 22

Disable UFW

If for some reason you need to disable UFW, you can do so with the following command:

sudo ufw disable

Enable UFW

To enable UFW on your system, run:

sudo ufw enable
1
  • First of all thank you for your answer. I guess I should have given a little more detail. Other users in the Cloud can make SSH connections without any problems, but when my user tries to log in, he gets a Could Not Connect error. This error popped up all of a sudden and I can't log in even though I tried everything, I did the necessary actions in UFWs but it didn't fix it. Nov 22, 2021 at 12:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .