![]() ![]() If something goes wrong, I obviously don't have physical access to my network. I travel a lot, which means that often my homelab is left unattended. I'd really like to make autossh work (I know I could find a workaround, like some crontab automatically relaunching my manual SSH tunnel but that'd probably be more brittle than making autossh work). The easiest, quick step-by-step guide for accessing your homelab network remotely via a reverse SSH tunnel on a Raspberry Pi (or any other Debian/Ubuntu device). Note that I don't think it's a firewalling issue as the "non autossh" method works fine (but then I don't get the automatic "always up" / reconnect feature). What am I not understanding here or doing wrong? It's not asking for password, it's not showing any terminal/prompt. OpenSSH_6.7p1 Debian-5+deb8u1, OpenSSL 1.0.1k ĭebug1: Reading configuration data /etc/ssh/ssh_configĭebug1: /etc/ssh/ssh_config line 19: Applying options for *ĭebug1: Connecting to localhost port 20000.ĭebug1: key_load_public: No such file or directoryĭebug1: identity file /home/ksproxy/.ssh/id_rsa type -1ĭebug1: identity file /home/ksproxy/.ssh/id_rsa-cert type -1ĭebug1: Enabling compatibility mode for protocol 2.0ĭebug1: Local version string SSH-2.0-OpenSSH_6.7p1 Debian-5+deb8u1 Here's a the -vvv output ssh -vvv -t -p 20000 If I try the correct port (20000) but this time with the -t param, same thing: it "works" but I don't get no terminal/prompt. Ssh: connect to host localhost port 1234: Connection refused If I try another port, it fails: ssh -p 1234 I tried to "-vvv" the output of the ssh commands but it just shows that nothing is going on. This "works" but it's just stuck there, doing nothing. Now I try the same but this time with autossh: $ autossh -M 20000 -N -i /home/rspi/.ssh/id_rsa ssh -p 20000 I can even access the Raspberry Pi from my desktop (by first going through the server), doing: ssh -t "ssh -p first ask for the server's password, then for the Pi's password and everything is fine. So everything works fine: I enter the password and I get a terminal/prompt. On the Rpi: $ ssh -N -R 20000:localhost:22 the server (the one with the static IP): ssh -t -p $ (I've changed the real IP here in this question to 37. to not post the server's actual IP) Now I'm trying to make autossh (from Debian / Raspbian package autossh) to work too but I'm not succeeding. The user account I'm using on the server is called "ksproxy" (it's not really a "proxy" but whatever). I managed to create a reverse SSH tunnel between a Raspberry Pi 2 and a server of mine (server which has a static IP) and it works fine. And when I go to run the command manually, after the Pi has booted, the tunnel comes up fine and I can connect to it without any hassle.(just asked this on SO but was adviced to take it here) When I reboot manually, I can see in tunnel.log that the job ran: Tue 4 Apr 13:34:īut the tunnel does not exist. RC was $?"Īnd here is the crontab: /usr/local/sbin/create_tunnel.sh > /usr/local/sbin/tunnel.log I have the following script create_tunnel.sh running in a cronjob (user and hostname removed obviously): /usr/bin/ssh -i /home/user/.ssh/id_rsa -N -R 4445:localhost:22 &Įcho "Tunnel to host created successfully"Įcho "An error occurred creating a tunnel to host. ![]() I need this tunnel to start when the Pi reboots so that I can always have access, even if the power goes in and out. I don't have physical access to this thing very often so I set up an ssh tunnel to access it remotely. I have a remote Pi that for various reasons tends to lose power occasionally and then boot back up. I have looked at various questions but none seems to work. ![]()
0 Comments
Leave a Reply. |