Note: Syncthing on WSL2

September 7, 2022
wsl

I like to use Syncthing to sync files between accounts and machines, and now even between my Windows subsystem and Windows itself.

To run Syncthing on WSL I use this script:

#!/usr/bin/env bash
SERVICE="syncthing"
USER="petar"
PORT=2103
OPTS="
        --no-browser
        --home=/home/$USER/.config/syncthing
        --gui-address=http://127.0.0.1:$PORT
        --logfile=/home/$USER/.config/syncthing/syncthing.log
"

if ! pgrep -x "$SERVICE" >/dev/null
then
        daemonize /usr/bin/syncthing serve "$OPTS"
fi

Make sure to change your username and to make the port unique, if you run multiple Syncthings on your machine.

Emacs on Windows WSL2 Rust Analyzer from Source