Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions content/docs/networking/remote-access.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,19 @@ Tailscale is not pre-installed on the device. However, Tailscale has added out-o
2. **On your local computer** (not on the JetKVM device), run the following command and follow the instructions:

```bash
curl -fsSL https://jetkvm.com/install-tailscale.sh | sh -s -- <jetkvm_ip>
curl -fsSL https://jetkvm.com/install-tailscale.sh | sh -s -- <jetkvm_ip> -i <path_to_ssh_key>
```

### Additional Tailscale Arguments

If you use a self-hosted Tailscale coordination server such as [Headscale](https://github.com/juanfont/headscale), you can pass additional arguments to the `tailscale up` command by appending them after `--` following the JetKVM IP address. Any arguments after the second `--` are forwarded directly to [`tailscale up`](https://tailscale.com/docs/reference/tailscale-cli/up).

```bash
curl -fsSL https://jetkvm.com/install-tailscale.sh | sh -s -- <jetkvm_ip> -- --login-server=https://headscale.example.com
curl -fsSL https://jetkvm.com/install-tailscale.sh | sh -s -- <jetkvm_ip> -i <path_to_ssh_key> -- --login-server=https://headscale.example.com
```

You can also combine multiple `tailscale up` flags:

```bash
curl -fsSL https://jetkvm.com/install-tailscale.sh | sh -s -- <jetkvm_ip> -- --login-server=https://headscale.example.com --advertise-tags=tag:kvm
curl -fsSL https://jetkvm.com/install-tailscale.sh | sh -s -- <jetkvm_ip> -i <path_to_ssh_key> -- --login-server=https://headscale.example.com --advertise-tags=tag:kvm
```
26 changes: 20 additions & 6 deletions content/scripts/install-tailscale.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ main() {
AUTO_YES=false
CLEAN_INSTALL=false
TAILSCALE_UP_ARGS=""
SSH_KEY="$HOME/.ssh/id_rsa"

# Parse command line arguments
while [ $# -gt 0 ]; do
Expand All @@ -22,6 +23,10 @@ main() {
REQUESTED_VERSION="$2"
shift 2
;;
-i | --identity)
SSH_KEY="$2"
shift 2
;;
-y | --yes)
AUTO_YES=true
shift
Expand All @@ -45,10 +50,11 @@ main() {
if [ -z "$JETKVM_IP" ]; then
echo "ERROR: JetKVM IP address is required"
echo ""
echo "Usage: $0 [-v|--version <TAILSCALE_VERSION>] [-y|--yes] [-c|--clean] <JETKVM_IP> [-- <tailscale_up_args>...]"
echo "Usage: $0 [-v|--version <TAILSCALE_VERSION>] [-i|--identity <SSH_KEY>] [-y|--yes] [-c|--clean] <JETKVM_IP> [-- <tailscale_up_args>...]"
echo ""
echo "Options:"
echo " -v, --version Specify Tailscale version (defaults to current stable release)"
echo " -i, --identity Path to the SSH private key for the JetKVM (defaults to ~/.ssh/id_rsa)"
echo " -y, --yes Automatically answer yes to confirmation prompt"
echo " -c, --clean Delete any existing tailscale data (will cause a new machine to be created)"
echo ""
Expand All @@ -72,6 +78,14 @@ main() {

export TAILSCALE_VERSION="${REQUESTED_VERSION:-$TAILSCALE_STABLE}"

if [ ! -f "$SSH_KEY" ]; then
echo "ERROR: SSH key not found at: $SSH_KEY"
echo " Provide a valid key path with -i/--identity, or place your key at ~/.ssh/id_rsa"
exit 1
fi

SSH_OPTS="-i $SSH_KEY -o IdentitiesOnly=yes"

# Confirmation prompt (unless auto-yes is enabled)
if [ "$AUTO_YES" = false ]; then
echo "──────────────────────────────────────────────────────────"
Expand Down Expand Up @@ -128,7 +142,7 @@ main() {
echo " Checking SSH access (Developer Mode)..."

# First, test SSH connectivity without BatchMode to get proper error messages
SSH_TEST_OUTPUT=$(ssh -o ConnectTimeout=5 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
SSH_TEST_OUTPUT=$(ssh $SSH_OPTS -o ConnectTimeout=5 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
-o PreferredAuthentications=publickey -o PubkeyAuthentication=yes -o PasswordAuthentication=no \
root@"$JETKVM_IP" 'echo "SSH OK"' 2>&1) || SSH_EXIT_CODE=$?

Expand Down Expand Up @@ -181,10 +195,10 @@ main() {
echo " Package verification successful"

echo "[5/7] Transferring Tailscale package to JetKVM..."
ssh root@"${JETKVM_IP}" "cat > /userdata/tailscale.tgz" <"$TMP_FILE"
ssh $SSH_OPTS root@"${JETKVM_IP}" "cat > /userdata/tailscale.tgz" <"$TMP_FILE"

echo "[6/7] Installing and configuring Tailscale on JetKVM..."
ssh -o ServerAliveInterval=1 -o ServerAliveCountMax=1 \
ssh $SSH_OPTS -o ServerAliveInterval=1 -o ServerAliveCountMax=1 \
root@"$JETKVM_IP" \
"export TAILSCALE_VERSION=$TAILSCALE_VERSION CLEAN_INSTALL=$CLEAN_INSTALL; ash -s" 2>/dev/null <<'EOF' || true
set -e
Expand Down Expand Up @@ -223,7 +237,7 @@ EOF
i=1
while [ "$i" -le 120 ]; do
echo " Checking device status... ($i/120s)"
if ssh -q -o ConnectTimeout=2 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
if ssh $SSH_OPTS -q -o ConnectTimeout=2 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
root@"$JETKVM_IP" 'tailscale version' >/dev/null 2>&1; then
echo " JetKVM is back online with Tailscale installed!"
break
Expand All @@ -240,7 +254,7 @@ EOF
done

echo "[7/7] Starting Tailscale service..."
ssh root@"$JETKVM_IP" "tailscale up $TAILSCALE_UP_ARGS"
ssh $SSH_OPTS root@"$JETKVM_IP" "tailscale up $TAILSCALE_UP_ARGS"
echo ""
echo "SUCCESS: Tailscale installation completed!"
echo " Your JetKVM device is now ready to connect to your Tailscale network."
Expand Down