My RPI’s on 24/7. I’d like my laptop to automatically reverse-ssh connect to it so the pi can send back commands to the laptop, even if the laptop’s in a random cafe. It’d be useful for unison and a couple of other things.
It’d be nice to make a reverse connection to the Pi such that if the laptop’s ever stolen, the laptop cannot execute commands on the pi (which is connected to two other machines).
Setup Forwarded port 22 to raspberry pi.
Pi’s public IP:188.8.131.52
So I’ve started on the laptop with
ssh-copy-id email@example.com and then
ssh -N -R 2222:localhost:22 firstname.lastname@example.org.
Next up, from the pi I’ve run:
ssh -l laptopusername -p 2222 localhost
Problem But the Pi says
kex_exchange_identification: read: Connection reset by peer, and at that point the laptop connection says
connect_to localhost: unknown host (Name or service not known).
On the advice of internet people, I’ve changed the /etc/ssh/sshd_config to include
GatewayPorts yes on both machines, then restarted the sshd service on both machines.
How’s the laptop host unknown? I’ve ssh’d into the pi, and I’ve established a connection from every machine to every machine on the home network.
If it matters, the laptop’s on Void Linux, and the Pi’s on Arch Arm.