SYNCTHING(1)

NAME
syncthing - Syncthing

SYNOPSIS

    syncthing [serve]
              [--home=<dir> | --config=<dir> --data=<dir>]
              [--allow-newer-config] [--audit] [--auditfile=<file|-|-->]
              [--db-maintenance-interval=<interval>]
              [--db-delete-retention-interval=<interval>]
              [--gui-address=<address>] [--gui-apikey=<key>]
              [--log-level=<level>] [--log-file=<filename>]
              [--log-max-old-files=<num>] [--log-max-size=<num>]
              [--log-format-timestamp=<format>] [--no-log-format-level-string]
              [--log-format-level-syslog]
              [--no-browser] [--no-console]
              [--no-port-probing] [--no-restart] [--no-upgrade]
              [--paused] [--unpaused]
              [--version] [--help] [--debug-*]
    syncthing cli
              [--home=<dir> | --config=<dir> --data=<dir>]
              [--gui-address=<address>] [--gui-apikey=<key>]
              [--help]
              <command> [command options...] [arguments...]
    syncthing browser
              [--home=<dir> | --config=<dir> --data=<dir>]
              [--help]
    syncthing decrypt (--to=<dir> | --verify-only)
              [--home=<dir> | --config=<dir> --data=<dir>]
              [--password=<pw>] [--folder-id=<id>] [--token-path=<file>]
              [--continue] [--verbose] [--help]
              <path>
    syncthing device-id
              [--home=<dir> | --config=<dir> --data=<dir>]
              [--help]
    syncthing generate
              [--home=<dir> | --config=<dir> --data=<dir>]
              [--gui-user=<username>] [--gui-password=<password|->]
              [--no-port-probing]
              [--help]
    syncthing paths
              [--home=<dir> | --config=<dir> --data=<dir>]
              [--help]
    syncthing upgrade
              [--home=<dir> | --config=<dir> --data=<dir>]
              [--check-only] [--from=<url>]
              [--help]
    syncthing version
              [--home=<dir> | --config=<dir> --data=<dir>]
              [--help]
    syncthing debug <command>
              [--home=<dir> | --config=<dir> --data=<dir>]
              [--help]

DESCRIPTION

Syncthing lets you synchronize your files bidirectionally across multiple devices. This means the creation, modification or deletion of files on one machine will automatically be replicated to your other devices. We believe your data is your data alone and you deserve to choose where it is stored. Therefore Syncthing does not upload your data to the cloud but exchanges your data across your machines as soon as they are online at the same time.

The syncthing core application is a command-line program which usually runs in the background and handles the synchronization. It provides a built-in, HTML and JavaScript based user interface to be controlled from a web browser. This frontend communicates with the core application through some HTTP APIs, which other apps like graphical system integration helpers can use as well, for greatest flexibility. A link to reach the GUI and API is printed among the first few log messages.

COMMON OPTIONS

--home=<dir>, -H <dir> ($STHOMEDIR)
    Set common configuration and data directory. The default configuration directory is $XDG_STATE_HOME/syncthing or $HOME/.local/state/syncthing (Unix-like), $HOME/Library/Application Support/Syncthing (Mac) and %LOCALAPPDATA%\Syncthing (Windows).

--config=<dir>, -C <dir> ($STCONFDIR)
    Set configuration directory. Alternative to --home and must be used together with --data.

--data=<dir>, -D <dir> ($STDATADIR)
    Set data (e.g. database) directory. Alternative to --home and must be used together with --config.

--help, -h
    Show help text about command line usage. Context-sensitive depending on the given subcommand.

SERVE OPTIONS

--allow-newer-config ($STALLOWNEWERCONFIG)
    Try loading a config file written by a newer program version, instead of failing immediately.

--audit ($STAUDIT)
    Write events to timestamped file audit-YYYYMMDD-HHMMSS.log.

--auditfile=<file|-|--> ($STAUDITFILE)
    Use specified file or stream ("-" for stdout, "--" for stderr) for audit events, rather than the timestamped default file name.

--db-maintenance-interval=<interval> ($STDBMAINTENANCEINTERVAL)
    Database maintenance interval – internal database maintenance routines run this often. The format is that of a Go duration string (see https://pkg.go.dev/time#ParseDuration).

--db-delete-retention-interval=<interval> ($STDBDELETERETENTIONINTERVAL)
    Database deleted item retention interval – deleted items are forgotten from the database after this interval. The format is that of a Go duration string (see https://pkg.go.dev/time#ParseDuration).

--gui-address=<address> ($STGUIADDRESS)
    Override GUI listen address. Set this to an address (0.0.0.0:8384) or a URL (http://0.0.0.0:8384). Supported schemes are http for plain HTTP, https for HTTP over TLS, unix for plain Unix sockets or unixs for TLS over Unix sockets. A Unix socket could look like this: unix:///run/syncthing/syncthing.socket (notice the three slashes: two as part of the URL structure, one to specify an absolute path).

--gui-apikey=<string> ($STGUIAPIKEY)
    Override the API key needed to access the GUI / REST API.

--log-file=<filename> ($STLOGFILE)
    Set destination filename for logging (use "-" for stdout, which is the default option).

--log-level=<level> ($STLOGLEVEL)
    Set the log level for all packages. Valid levels are DEBUG, INFO, WARN, and ERROR.

--log-max-old-files=<num> ($STLOGMAXOLDFILES)
    Number of old files to keep (zero to keep only current). Applies only when log rotation is enabled through --log-max-size.

--log-max-size=<num> ($STLOGMAXSIZE)
    Maximum size in bytes of any log file (zero to disable log rotation).

--log-format-timestamp=<format> ($STLOGFORMATTIMESTAMP)
    Format for timestamp, set to empty to disable timestamps. The format is that of the Go time formatter (see https://pkg.go.dev/time#Layout).

--[no-]log-format-level-string ($STLOGFORMATLEVELSTRING)
    Whether to include level string (e.g. “INF”) in log line.

--[no-]log-format-level-syslog ($STLOGFORMATLEVELSYSLOG)
    Whether to include level as syslog prefix (e.g. “<6>”) in log line.

--no-browser ($STNOBROWSER)
    Do not start a browser.

--no-console ($STNOCONSOLE)
    Hide the console window. (On Windows only)

--no-port-probing ($STNOPORTPROBING)
    Don’t try to find unused random ports for the GUI and listen address when generating an initial configuration / starting for the first time.

--no-restart ($STNORESTART)
    Do not restart Syncthing when it exits. The monitor process will still run to handle crashes and writing to logfiles (if configured to).

--no-upgrade ($STNOUPGRADE)
    Disable automatic upgrades.

--paused ($STPAUSED)
    Start with all devices and folders paused.

--unpaused ($STUNPAUSED)
    Start with all devices and folders unpaused.

--version
    Show the current version information, then exit.

--debug-*
    Several debug options exist. See syncthing serve --help for the flags that apply to your version.

DECRYPT OPTIONS

--to=<dir>
    Destination directory where files should be stored after decryption.

--verify-only
    Don’t write decrypted files to disk (but verify plaintext hashes).

--password=<pw> ($FOLDER_PASSWORD)
    Folder password for decryption / verification. Can be passed through the FOLDER_PASSWORD environment variable instead to avoid recording in a shell’s history buffer or sniffing from the running processes list.

--folder-id=<id>
    Folder ID of the encrypted folder, if it cannot be determined automatically.

--token-path=<file>
    Path to the token file within the folder (used to determine folder ID).

--continue
    Continue processing next file in case of error, instead of aborting.

GENERATE OPTIONS

--gui-password=<password|->
    Specify new GUI authentication password, to update the config file. Read from the standard input stream if only a single dash (-) is given. A plaintext password is hashed before writing to the config file, but an already bcrypt-hashed input is stored verbatim. As a special case, giving the existing password hash as password will leave it untouched.

--gui-user=<username>
    Specify new GUI authentication user name, to update the config file.

UPGRADE OPTIONS

--check-only
    Do not upgrade, only indicate whether an upgrade is available.

--from=<url>
    Upgrade to the Syncthing version available from loading the package at the given URL.

EXIT CODES

0   Success / Shutdown

1   Error

2   Upgrade not available

3   Restarting

4   Upgrading

    Exit codes over 125 are usually returned by the shell/binary loader/default signal handler. Exit codes over 128+N on Unix usually represent the signal which caused the process to exit. For example, 128 + 9 (SIGKILL) = 137.

SUBCOMMANDS

The command line syntax supports different modes of operation through several subcommands, specified as the first argument. If omitted, the default serve is assumed.

The initial setup of a device ID and default configuration can be called explicitly with the generate subcommand. It can also update the configured GUI authentication credentials, without going through the REST API. An existing device certificate is left untouched. If the configuration file already exists, it is validated and updated to the latest configuration schema, including adding default values for any new options.

The decrypt subcommand is used in conjunction with untrusted (encrypted) devices, see the relevant section on decryption for details. It does not depend on Syncthing to be running, but works on offline data.

To work with the REST API for debugging or automating things in Syncthing, the cli subcommand provides easy access to individual features. It basically saves the hassle of handling HTTP connections and API authentication.

The available subcommands are grouped into several nested hierarchies and some parts dynamically generated from the running Syncthing instance. On every level, the --help option lists the available properties, actions and commands for the user to discover interactively. The top-level groups are:

config
    Access the live configuration in a running instance over the REST API to retrieve (get) or update (set) values in a fine-grained way. The hierarchy is based on the same structure as used in the JSON / XML representations.

show
    Show system properties and status of a running instance. The output is passed on directly from the REST API response and therefore requires parsing JSON format.

operations
    Control the overall program operation such as restarting or handling upgrades, as well as triggering some actions on a per-folder basis. Can also configure the default ignore patterns from a plain text ignore file.

errors
    Examine pending error conditions that need attention from the user, or acknowledge (clear) them.

debug
    Various tools to aid in diagnosing problems or collection information for bug reports. Some of these commands access the database directly and can therefore only work when Syncthing is not running.

- (a single dash)
    Reads subsequent commands from the standard input stream, without needing to call the syncthing cli command over and over. Exits on any invalid command or when EOF (end-of-file) is received.

PROXIES

Syncthing can use a SOCKS, HTTP, or HTTPS proxy to talk to the outside world. The proxy is used for outgoing connections only - it is not possible to accept incoming connections through the proxy. The proxy is configured through the environment variable all_proxy. Somewhat unusually, this variable must be named in lower case - it is not “ALL_PROXY”. For example:

    $ export all_proxy=socks://192.0.2.42:8081

DEVELOPMENT SETTINGS

The following environment variables modify Syncthing’s behavior in ways that are mostly useful for developers. Use with care. If you start Syncthing from within service managers like systemd or supervisor, path expansion may not be supported.

STTRACE
    Used to increase the debugging verbosity in specific facilities, generally mapping to a Go package. Enter a comma-separated string of facilities to trace: api,beacon. Optionally, a log level can be given per facility to specify something other than DEBUG: api:WARN,beacon:ERROR, potentially overriding a global --log-level adjustment.

    The valid facility strings are listed below; additionally, syncthing serve --help always outputs the most up-to-date list.

api REST API

beacon
    Multicast and broadcast discovery

config
    Configuration loading and saving

connections
    Connection handling

db/sqlite
    SQLite database

dialer
    Dialing connections

discover
    Remote device discovery

events
    Event generation and logging

fs  Filesystem access

main
    Main package

model
    The root hub

nat NAT discovery and port mapping

pmp NAT-PMP discovery and port mapping

protocol
    The BEP protocol

relay/client
    Relay client

scanner
    File change detection and hashing

stun
    STUN functionality

syncthing
    Main run facility

upgrade
    Binary upgrades

upnp
    UPnP discovery and port mapping

ur  Usage reporting

versioner
    File versioning

watchaggregator
    Filesystem event watcher

STLOCKTHRESHOLD
    Used for debugging internal deadlocks; sets debug sensitivity. Use only under direction of a developer.

STVERSIONEXTRA
    Add extra information to the version string in logs and the version line in the GUI. Can be set to the name of a wrapper or tool controlling syncthing to communicate this to the end user.

GOMAXPROCS
    Set the maximum number of CPU cores to use. Defaults to all available CPU cores.

GOGC
    Percentage of heap growth at which to trigger GC. Default is 100. Lower numbers keep peak memory usage down, at the price of CPU usage (i.e. performance).

LOGGER_DISCARD
    Hack to completely disable logging, for example when running benchmarks. Set to any nonempty value to use it.

SEE ALSO

syncthing-config(5), syncthing-stignore(5), syncthing-device-ids(7), syncthing-security(7), syncthing-networking(7), syncthing-versioning(7), syncthing-faq(7)

AUTHOR
The Syncthing Authors

COPYRIGHT
2014-2025, The Syncthing Authors