Skip to content

Instantly share code, notes, and snippets.

@mitanshu7
Last active May 20, 2025 03:30
Show Gist options
  • Save mitanshu7/babc5cb9ce0cdc63af40d31f8a330ba4 to your computer and use it in GitHub Desktop.
Save mitanshu7/babc5cb9ce0cdc63af40d31f8a330ba4 to your computer and use it in GitHub Desktop.
Tailscale without root

Fetch appropriate binaries from here: https://pkgs.tailscale.com/stable/#static

Make them executible with:

chmod +x /home/mitanshu/tailscale/tailscaled
chmod +x /home/mitanshu/tailscale/tailscale

Create a bash script with nano /home/mitanshu/tailscale/start_tailscaled.sh:

#!/bin/bash

# Path to the tailscaled binary
TAILSCALED_START="/home/mitanshu/tailscale/tailscaled --state=/home/mitanshu/.local/share/tailscale/tailscaled.state --socket=/home/mitanshu/tailscale/tailscaled.sock -tun userspace-networking --port=41641"
TAILSCALED_CLEAN="/home/mitanshu/tailscale/tailscaled --cleanup"

# Function to check if tailscaled is running
is_running() {
    pgrep -x tailscaled > /dev/null
}

# Start tailscaled if not running
if ! is_running; then
    date
    echo "Starting tailscaled..."
    nohup $TAILSCALED_CLEAN > /home/mitanshu/tailscale/tailscaled.log 2>&1 &
    nohup $TAILSCALED_START > /home/mitanshu/tailscale/tailscaled.log 2>&1 &
else
    date
    echo "tailscaled is already running."
fi

add cronjob using: crontab -e

@reboot /home/mitanshu/tailscale/start_tailscaled.sh
* * * * * /home/mitanshu/tailscale/start_tailscaled.sh

Run tailscale using: tailscale --socket=/home/mitanshu/tailscale/tailscaled.sock up

Login using the url shown and voila!

@mitanshu7
Copy link
Author

If multiple people are using tailscale, change to a free port and do the following:

  1. from
    --port=41641
    to
    --port=41642
  2. from
    pgrep -x tailscaled
    to
    pgrep -f 41642

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment