# HTTP Bridge — SSH-less Remote Access

**When:** SSH connects at TCP level + negotiates protocol but **hangs during PAM/auth**.
Symptoms: `nc -zv` shows port open, ping works, but `ssh` times out after "Authenticating to <host>".

**Root cause:** Usually PAM module hang (pam_systemd, pam_limits), `UseDNS=yes`, or GSSAPI timeout
on the target machine. Common on Arch/CachyOS after certain updates.

## Technique: HTTP File Server Bridge

From your machine (where you can serve files):

```bash
# 1. Write what you need (SSH key, fix script, etc.)
echo "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA..." > /tmp/pubkey.txt

# 2. Start HTTP server from /tmp
cd /tmp && python3 -m http.server 18900 --bind 0.0.0.0
```

From the target machine's TTY (user pastes this):

```bash
# Fetch SSH key (shortest possible command)
curl -s http://<YOUR_IP>:18900/pubkey.txt >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys

# Or pipe an entire fix script
curl -s http://<YOUR_IP>:18900/fix.sh | bash
```

Then SSH from your machine works.

## Pitfalls

- **Python http.server is single-threaded** — fine for one-off file fetches.
- **Firewall on serving machine** — port 18900 must be reachable from target. Use `0.0.0.0` bind.
- **User is on TTY** — commands must be short enough to type. Prefer curl-pipe over manual key typing.
- **No auth on the HTTP server** — anyone on LAN can fetch files. Kill server after use.
- **curl may not be installed** — fallback: `wget -qO- http://<IP>:18900/pubkey.txt >> ~/.ssh/authorized_keys`

## Alternatives if curl/wget unavailable

```bash
# Using /dev/tcp (bash built-in, no external deps)
exec 3<>/dev/tcp/192.168.1.50/18900 && echo -e "GET /pubkey.txt HTTP/1.0\r\n\r\n" >&3 && cat <&3 | tail -1 >> ~/.ssh/authorized_keys && exec 3>&-
```
