A
A
andrejsi2021-01-04 23:54:49
ubuntu
andrejsi, 2021-01-04 23:54:49

How to open port 22 on Ubuntu?

Good afternoon,
Do not judge strictly for the question, there is not much experience with Ubuntu.
Given - after updating Ubuntu to version 20.04.1 c 16, and initially from 14, I can’t connect to the server through port 22, everything worked fine before the update. Connected via the web console, which limits the readability of some commands. I check through the
Code sudo iptables - L, it gives out a mountain of unreadable information, in which I can’t even find port 22. It was not possible to open
through , although it shows ALLOW from Anywhere. It also failed to open through , ping.eu shows that port 22 is closed, and it can not be opened in any way. When connecting to the server - The connection was interrupted. shows that only ports 80 and 443 are open.sudo ufw allow sshsudo ufw status
sudo iptables -A INPUT -p tcp --dport 22 -j ACCEPT
sudo nmap localhost
Can someone give advice on what to do?

Thanks Andrey

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Denis Yuriev, 2021-01-05
@andrejsi

Based on the comments - your port is not closed, and the ssh server has not started.
Hard reinstallation of openssh-server forcing rewriting of configs to default ones

sudo mv /etc/ssh /etc/ssh_backup
sudo apt install --reinstall -o Dpkg::Options::="--force-confask,confnew,confmiss" openssh-server
sudo service sshd restart

Or watch what sshd does not start and fix

K
ky0, 2021-01-05
@ky0

Judging by the screenshot from the comment, you just don’t have an SSH server running, the firewall has nothing to do with it, we disagree. Well, in general - it would be strange if some updates destroyed access via SSH.
Nail the configs and reinstall the service, most likely it will help.

V
Valdemar Smorman, 2021-01-05
@smorman

And so :
sudo ufw allow in 22/tcp

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question