Problems setting up ssh

Problems setting up ssh:

Goal

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.

Bonus Points

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:111.111.111.111

So I’ve started on the laptop with ssh-copy-id piusername@111.111.111.111 and then ssh -N -R 2222:localhost:22 piusername@111.111.111.111.

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.

Additional

If it matters, the laptop’s on Void Linux, and the Pi’s on Arch Arm.

submitted by /u/Andonome
[link] [comments] via Linux 101 stuff. Questions are encouraged, noobs are welcome!