SSH into a Raspberry Pi from anywhere
At home, ssh pi@raspberrypi.local works. From another network it
does not, because nothing on the internet can reach the Pi. The Pi has to dial
out.
Why the usual setup fails
The classic answer is a port forward on the router for port 22, plus dynamic DNS so you have a name for a home address that changes. It works only if three things hold:
- The router is yours to configure. A Pi at a client's site, a shop or a relative's house sits behind a router you cannot change.
- The router has a public IPv4 address. Many home and mobile links do not: the provider shares one address between customers, and a forward on your router is never reached. To check, compare the WAN address on the router's status page with your public IP from any "what is my IP" site. If they differ, see SSH behind CGNAT.
-
You are happy to leave the SSH port open to the whole internet. If you are,
turn off password logins (
PasswordAuthentication noinsshd_config) and use keys only. Moving to another port cuts the log noise, not the risk.
If all three hold, a forward with keys only is simple and costs nothing. This page is for when one of them does not.
Ways to reach a Pi that has no open port
Raspberry Pi Connect
Raspberry Pi's own service. Per its documentation, read on 25 November 2026, it is free for personal accounts, needs Raspberry Pi OS Bookworm or later, and links your browser to the Pi directly where it can and through an encrypted relay where it cannot. It gives a remote shell, and screen sharing on the full version; the Lite version, the default on Raspberry Pi OS Lite, is shell only. If you have one Pi, a Raspberry Pi account and nothing to manage beyond it, it is hard to beat on price.
A VPN mesh, such as Tailscale or WireGuard
The Pi and your laptop join one private network, and you ssh to the Pi's address on it. You get every port, not only a shell. You also install and keep up a client on the Pi and on every machine you connect from, and the Pi joins your network and stays in it.
A reverse SSH tunnel to a server you rent
The Pi runs ssh -R to a server with a public address and you log
in there, then to the port that leads back. It is fine for one Pi if you
already have the server. You patch the server, and you keep the tunnel alive:
see
why autossh tunnels drop.
A hosted relay, which is what RescueShell is
An agent on the Pi keeps one outbound HTTPS connection to the relay, and you open a shell from the browser or the CLI. You run no server and add no client to the network. The relay is a dependency: if it is unreachable you cannot open a shell. It suits Pis you hand to other people, or a handful you want listed in one place with who opened a shell and when. The three approaches compared.
RescueShell on a Raspberry Pi
This is what the product does today.
1. Turn on SSH, and put your key on the Pi
A shell is a session on the Pi's own OpenSSH server, which Raspberry Pi OS
ships switched off. Turn it on in raspi-config under Interface
Options, or run:
sudo systemctl enable --now ssh
Then, from your laptop, put the key you will use on the Pi. The installer
copies the trusted keys from an account's
~/.ssh/authorized_keys, so they must be there first:
ssh-copy-id pi@raspberrypi.local
Use the account you created when you set up the Pi; it is only called
pi on older images. If you have no key yet, run
ssh-keygen -t ed25519 first.
2. Check the Pi
uname -m
openssl version
command -v curl
It needs curl or wget. The installer picks the build from
uname -m: aarch64 gets arm64,
armv7l gets armv7 and armv6l, the Zero and Pi 1,
gets armv6. Any other CPU stops with unsupported CPU. It checks
the release signature with OpenSSL 3, which Raspberry Pi OS has from Bookworm
on. On an older image pass --sha256. It never installs packages
itself.
3. Install
In the web app, open Devices. On a new team the checklist is
already there; once you have devices, press Add device. Name
the Pi and press Create pass. Then, on the Pi, over SSH on
your home network or at its console, run this as root (for example after
sudo -i):
curl -fsSL https://releases.rescueshell.com/latest/install.sh | sh -s -- \
--base-url https://releases.rescueshell.com/latest --relay https://app.rescueshell.com \
--name pump-07 --trust-keys-from pi
Change pi to your account, and pump-07 to a name for
the Pi. The installer lists each key it will trust by fingerprint and asks you
to confirm, then asks Registration pass or token:. Paste the pass
and nothing shows as you do. It ends with a host key: line. Keep
it, because the browser asks for it the first time you open a shell. Our
servers cannot add a key to the Pi's list. See
add a device for the other options.
On systemd, which Raspberry Pi OS uses, it sets up
rescueshell-agent.service. It starts once the network is online
and restarts the agent if it fails. It adds one sshd drop-in in
/etc/ssh/sshd_config.d/ and does not edit your main
sshd_config. Check it with
systemctl status rescueshell-agent or
rescueshell-agent --status.
4. Open a shell from anywhere
When the Pi shows as connected under Devices, open a shell from the browser, or from your own terminal with the CLI. Try it from a different network, such as your phone's hotspot, before you rely on it.
The Pi needs outbound HTTPS and nothing inbound. When the link drops, the agent retries every 60 seconds, five times, then waits 30 minutes and starts over, so a Pi that was offline comes back by itself.
What it does not do
- It is a shell on the Pi, with one open shell per device at a time. There is no desktop or VNC, and port forwarding through a session is off, so a web page or another machine on the Pi's network is not reachable this way. For a desktop, Raspberry Pi Connect or a mesh is the better fit.
- OpenSSH only. Dropbear is not supported.
- A Pi that is powered off, or has no network, cannot be reached. Nothing here replaces a power cycle or a console.
- The agent cannot use a network where web traffic only leaves through an HTTP proxy. At a client's site, see what to ask their IT team.
- Our device matrix runs Debian and Ubuntu containers and an Alpine 32-bit ARM machine in QEMU, not Raspberry Pi hardware.
If the shell does not open, see the shell does not open. For many Pis, builds and a read-only root, see Remote SSH for a fleet of Raspberry Pis.
Try it on one Pi
The first device is free to try with no card, for 30 days from when it connects, not from when you sign up. Start a trial.