Skip to content

Instantly share code, notes, and snippets.

@qingy1337
Last active June 13, 2025 15:30
Show Gist options
  • Save qingy1337/03e2f09a9cf6c102958a9cdceb51e2f0 to your computer and use it in GitHub Desktop.
Save qingy1337/03e2f09a9cf6c102958a9cdceb51e2f0 to your computer and use it in GitHub Desktop.
Tailscale Useful Stuff

To set up the auth key, run:

# Create a directory for the auth key
sudo mkdir -p /etc/tailscale

# Store the auth key in a file with secure permissions
# Replace 'tskey-auth-abc123' with the actual auth key you generated.
echo "tskey-auth-abc123" | sudo tee /etc/tailscale/authkey
sudo chmod 600 /etc/tailscale/authkey

# Create the systemd service file
sudo tee /etc/systemd/system/tailscale-up.service <<EOF
[Unit]
Description=Tailscale Up
After=tailscaled.service network-online.target
Requires=tailscaled.service
Wants=network-online.target

[Service]
ExecStart=/usr/bin/tailscale up --authkey-file=/etc/tailscale/authkey --accept-routes=true --accept-dns=true
Restart=on-failure
RestartSec=5s
StartLimitInterval=60s
StartLimitBurst=3

[Install]
WantedBy=multi-user.target
EOF

# Enable and start the new service
sudo systemctl daemon-reload
sudo systemctl enable tailscale-up.service
sudo systemctl start tailscale-up.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment