Connection abruptly terminated by remote host when trying to gain ssh access a windows computer from outside the local network

I have a windows computer and would like to gain ssh access to powershell from outside my home network. For this purpose, I opened a TCP port on my router and set up automatic forwarding to the computer I want to connect to.

Then, I created a rule in my firewall:

netsh advfirewall firewall add rule name="ps_ssh" dir=in action=allow  protocol=TCP localport=<port_number>

Then I installed and enabled ssh in a powershell admin window:

  Add-WindowsCapability -Online -Name OpenSSH.Server
  Start-Service sshd
  Set-Service -Name sshd -StartupType 'Automatic'

Then I modified my %ProgramData%/ssh/sshd_config file to reflect the following options:

ListenAddress 0.0.0.0
LogLevel DEBUG3
PubkeyAuthentication yes

# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2
# but this is overridden so installations will only check .ssh/authorized_keys
# AuthorizedKeysFile .ssh/authorized_keys

Subsystem   sftp    sftp-server.exe
Match Group administrators
       AuthorizedKeysFile __PROGRAMDATA__/ssh/administrators_authorized_keys

And then I copied the ~/.ssh/ed25519.pub file from the computer I want to connect with from the outside to a line in C:Users<username>.sshauthorized_keys like

ssh-ed25519 <hash> <user_name>

ending with a newline.

However, when we then try to connect to my home computer from the outside, we get

$ ssh -vvv -i ~/.ssh/id_ed25519 <my_global_ip> -p 22
OpenSSH_8.9p1 Ubuntu-3ubuntu0.4, OpenSSL 3.0.2 15 Mar 2022
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug2: resolve_canonicalize: hostname <my_global_ip> is address
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/home/snkr/.ssh/known_hosts'
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/home/snkr/.ssh/known_hosts2'
debug3: ssh_connect_direct: entering
debug1: Connecting to <my_global_ip> [<my_global_ip>] port <port_number>.
debug3: set_sock_tos: set socket 3 IP_TOS 0x10
debug1: Connection established.
debug1: identity file /home/snkr/.ssh/id_ed25519 type 3
debug1: identity file /home/snkr/.ssh/id_ed25519-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.9p1 Ubuntu-3ubuntu0.4
kex_exchange_identification: read: Connection reset by peer
Connection reset by <my_global_ip> port <port_number>

ssh-keyscan reveals we are not even able to fetch a public key:

$ ssh-keyscan -H <my_global_ip>
89.245.9.216: Connection closed by remote host
89.245.9.216: Connection closed by remote host
89.245.9.216: Connection closed by remote host
89.245.9.216: Connection closed by remote host
89.245.9.216: Connection closed by remote host

Pinging <my_global_ip> works, but telnet also immediately has it’s connection aborted:

$ telnet 89.245.9.216 22
Trying 89.245.9.216...
Connected to 89.245.9.216.
Escape character is '^]'.
Connection closed by foreign host.

And if we look at the OpenSSH logs in the Windows EventViewer, no trace of any connection attempt is logged, only the instances when we ran Restart-Service sshd. This makes me suspect that the Windows firewall is causing problems, but temporarily disabling it also didn’t resolve any of the abovementioned issues.

In this given setup, what exactly are we missing?

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật