I have set up an OpenSSH server on my home PC (Ubuntu 22.04 LTS) and am trying to connect to it using ssh and sshfs from my Laptop (Ubuntu 20.04 LTS).
The server seems to be running smoothly and I can easily access it, while in the same network. As I can't configure a port forwarding (the router I got from my ISP doesn't allow it), I am trying to use NordVPN's Meshnet to establish a connection.
Using the NordVPN hostname or IP, I can connect as well, while in the same network. The problem arises, when trying to connect from a different network:
- While the first ssh connection is working properly, if I exit this connection and try connecting again, the connection fails with "Connection closed by port 22"
- When I try to establish an sshfs connection, I have the same problem. Curiously, if I add the sshfs command to my startup applications, it works at first (I can access the directory via Files, open files, etc.), but disconnects after roughly half a minute.
- purging and reinstalling nordvpn enables one connection to be made again, same if I run
iptables -F
andsudo systemctl restart NetworkManager
- when running
service ssh status
on the PC it shows "fatal: Timeout before authentication for port 47176" (this port changes each time)
Things I have tried so far:
- Ran
sudo ufw allow ssh
on both devices - Added
sshd: <Client meshnet IP>
to "/etc/hosts.allow" on the host - Flushed all iptables rules and set the default policy to ACCEPT
- removed all NordVPN settings and config files
- ran
nordvpn whitelist add port 22
on both devices
The last few were recommended by the NordVPN support (which gave up). I'm not ready to let this idea go yet, as it would allow me to leave my external drives at home and access them remotely, instead of taking them everywhere and wearing them down.
If anyone has an idea on what else I could try/where to look into, I'd appreciate it.