Home Posts Now

SSH configuration

My Raspberry PI is part of my tailnet. I wanted to use it as a jump box to connect to some other Tailscale hosts from machines that aren't part of the tailnet. This can be configured by editing ~/.ssh/config (see this link for more details):

Host *
  ServerAliveInterval 60

Host raspberrypi
  HostName 192.168.1.59
  User mario

Host remote-host
  HostName remote-host.domain.com
  ProxyCommand ssh -W %h:%p raspberrypi

This works even better if I use key-based authentication.

In ~/.ssh/config I can tell where the keys are:

Host *
  AddKeysToAgent yes
  UseKeychain yes
  IdentityFile ~/.ssh/id_ed25519

and then tell the Raspberry PI to trust it via cat ~/.ssh/id_ed25519.pub | ssh username@remote_host "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"