0

I got a small setup with two private servers ps1 and ps2 at home behind a NAT. One server s1 with public domain s1.com is a small rented vps where I set up as reverse proxy with caddy.

On ps1 I had a docker container with home assistant. I used autossh to connect to s1:

autossh -M 0 -f -o ConnectTimeout=10 -o ServerAliveInterval=60 -o ServerAliveCountMax=2 -i /home/user/.ssh/id_ed25519 -N -R 8090:ps1:8123 s1.com

Caddy is providing the reverse proxy from port 8090 to ha.s1.com.

That machine was too slow for it so I switched home assistant to ps2. Spun up the container and imported the backup, now runing nicely locally. I adaptet above autossh command to connect s1 to ps2, stopped the autossh command on ps1. However the autossh command is not working.

I only shows using just the ssh command:

ssh -M 0 -f -o ConnectTimeout=10 -o ServerAliveInterval=60 -o ServerAliveCountMax=2 -i /home/user/.ssh/id_ed25519 -N -R 8090:ps2:8123 s1.com
[email protected]: Permission denied (publickey).

I can simply log in with the key via:

ssh -i /home/user/.ssh/id_ed25519 s1.com
Welcome to Ubuntu 24.04.3 LTS (GNU/Linux 6.8.0-88-generic x86_64) <- s1

When home assistant was running on ps1 I noticed that browsing ha.s1.com lead to a local connection to ps1. That fact now hinders the establishment of the autossh command.

It has been two days like this. I rebootet several times and hoped for an automated dns cache deletion. Does anyone have an idea how to to that manually and on which machine?

New contributor
dabozz is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
3
  • It might help to run both ssh commands with -v and compare the outputs. And maybe also increase the log level on the server. Commented 2 days ago
  • 1
    The -M 0 option is for autossh. You shouldn't use it when connecting directly with ssh. Commented 2 days ago
  • Yes, -M 0 for ssh would mean connect to IPv4 address 0 (short for 0.0.0.0, so the local host) in master mode. Hence the [email protected] in the error message. Commented 2 days ago

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.