Skip to content

Instantly share code, notes, and snippets.

@mitanshu7
Last active August 10, 2025 08:50
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
title subtitle author date lang description keywords
How to run Tailscale without root
**Longing to connect to your lab server?**
_Mitanshu Sukhwani_
`2025-06-07`
en
Learn how to set up and run Tailscale in user-space without root access. Includes steps for downloading static binaries, configuring tailscaled with a custom socket and port, automating startup via cron, and troubleshooting multi-user setups.
Tailscale, user-space networking, tailscaled, cron job, Linux, static binaries, multi-user setup

Get tailscale

  1. Fetch appropriate binaries for your architecture from here: Tailscale Packages - stable track

  2. Untar using:

tar xvf tailscale_*.tgz
  1. Rename folder:
mv tailscale_*/ tailscale/
  1. Add folder to path & alias by appending the following lines in ~/.bashrc:
export PATH="$HOME/tailscale:$PATH"
alias tailscale='tailscale --socket=$HOME/tailscale/tailscaled.sock'

With Systemd (Recommended)

  1. Create the systemd user config directory:
mkdir -p ~/.config/systemd/user/
  1. Create a service file using:
nano ~/.config/systemd/user/tailscaled.service
  1. With the following contents:
[Unit]
Description=Tailscale node agent
Documentation=https://tailscale.com/kb/
Wants=network-pre.target
After=network-pre.target NetworkManager.service systemd-resolved.service

[Service]
ExecStart=%h/tailscale/tailscaled --state=%h/tailscale/tailscaled.state --socket=%h/tailscale/tailscaled.sock -tun=userspace-networking --port=41641
ExecStopPost=%h/tailscale/tailscaled --cleanup

Restart=always
RestartSec=5

StandardOutput=append:%h/tailscale/tailscaled.log
StandardError=append:%h/tailscale/tailscaled.log

[Install]
WantedBy=default.target

%h redirects to $HOME variable.

  1. Reload daemon, start & enable the service, and check the status:
systemctl --user daemon-reload
systemctl --user enable --now tailscaled.service
systemctl --user status tailscaled.service
  1. Run the client with:
tailscale --socket=$HOME/tailscale/tailscaled.sock up
  1. Log in and profit!

Without Systemd (Hacky)

  1. Create a bash script
nano $HOME/tailscale/start_tailscaled.sh
  1. With the following contents:
#!/bin/bash

# Path to the tailscaled binary
TAILSCALED_START="$HOME/tailscale/tailscaled --state=$HOME/tailscale/tailscaled.state --socket=$HOME/tailscale/tailscaled.sock -tun=userspace-networking --port=41641"
TAILSCALED_CLEAN="$HOME/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/tailscale/tailscaled.log 2>&1 &
    nohup $TAILSCALED_START >> $HOME/tailscale/tailscaled.log 2>&1 &
else
    date
    echo "tailscaled is already running."
fi
  1. Modify the crontab via
crontab -e
  1. With
@reboot $HOME/tailscale/start_tailscaled.sh
* * * * * $HOME/tailscale/start_tailscaled.sh
  1. Run tailscale using:
tailscale --socket=$HOME/tailscale/tailscaled.sock up
  1. Login using the url shown and enjoy!

Bonus:

If multiple people are using Tailscale without root, change to a free port and modify the following in your systemd.service/bash.script:

  1. from
--port=41641

to

--port=41642
  1. Only in bash script:

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