Pastebin

Untitled

text 6 views Created: November 3, 2026 at 04:17:53 EST
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env bash
# Arch ISO emergency remote access. Only configures the live environment.
# OPTIONAL: Replace the placeholder with ONE PUBLIC SSH KEY from your Mac.
# Never put private keys, LUKS passwords or Tailscale auth keys in this file.
SSH_PUBLIC_KEY='ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAdSBMUPdA2ucQid9rsWNDqdwlDQd015tSFcM7tF5/Im priyansh'

set -Eeuo pipefail
trap 'echo; echo "SETUP FAILED at line $LINENO. Photograph this screen for the owner."' ERR

if [[ "$EUID" -ne 0 || ! -d /run/archiso ]]; then
  echo 'STOP: this is not a root shell in an Arch ISO live environment.'
  exit 1
fi

echo 'Setting up TEMPORARY remote access to Arch Live. Do not power off.'
pacman -Sy --noconfirm tailscale openssh

# Optional second SSH route, independent of Tailscale SSH policy.
# Only public-key authentication is allowed. Uses port 2222 to avoid
# conflicting with Tailscale SSH on port 22.
if [[ "$SSH_PUBLIC_KEY" == ssh-* || "$SSH_PUBLIC_KEY" == ecdsa-* ]]; then
  install -d -m 700 /root/.ssh /etc/ssh/sshd_config.d
  printf '%s\n' "$SSH_PUBLIC_KEY" > /root/.ssh/authorized_keys
  chmod 600 /root/.ssh/authorized_keys
  cat > /etc/ssh/sshd_config.d/90-arch-live-rescue.conf <<'SSHCONF'
Port 2222
PasswordAuthentication no
KbdInteractiveAuthentication no
PermitRootLogin prohibit-password
SSHCONF
  ssh-keygen -A
  if systemctl restart sshd; then
    echo 'OpenSSH key-based fallback started on port 2222.'
  else
    echo 'OpenSSH fallback failed; trying Tailscale SSH anyway.'
  fi
else
  echo 'No Mac public key configured; relying on Tailscale SSH policy.'
fi

systemctl start tailscaled
echo
echo 'IMPORTANT: Photograph the Tailscale login URL below and send it to the owner.'
echo 'The owner must open that URL to approve this machine.'
echo
tailscale up --ssh --hostname=arch-rescue

echo
echo '========== ARCH LIVE REMOTE ACCESS READY =========='
tailscale ip -4
echo 'Do not reboot, switch boot entries, or turn off the smart plug.'
echo 'The owner can now connect and retrieve the file.'
echo '=================================================='

Embed this paste

Install this app

  1. Tap the Share button
  2. Scroll down and tap "Add to Home Screen"
  3. Tap "Add" in the top right

Please confirm