Nextcloudpi: SSH remote access

Hi everyone, hope somebody can help me access my ncp via SSH from outside my local network.

Setup:

  • RaspberryPi 3B+ running the latest NextcloudPi version (fresh installation).
  • WLAN connection to router with ports 80 & 443 open, and port forwarding from port 2301 (outside) to port 20 at my raspbi.
  • No-IP DDNS

The issue you I’m facing:

When I’m trying to access my pi from outside my local network via ssh pi@[public IP] -p 2301 I get a Connection refused.
From within my local network it works fine (so SSH is correctly enabled on the pi) and connections via HTTP(S) work fine (so the pi is reachable from the outside and port forwarding works as expected for port 443 and 80).

Any idea what else I have to do to access my pi remotely?

By default ssh will listen on port 22
Unless you changed Listen in sshd_config, try forwarding to 22 instead of 20.

Keep in mind there are also a lot of security implications in doing this.

Correct, one should enable ufw and fail2ban. Which is just a few clicks away in ncp-config or ncp-web.