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!
If multiple people are using tailscale, change to a free port and do the following:
--port=41641
to
--port=41642
pgrep -x tailscaled
to
pgrep -f 41642