# Syncthing — Open Source Peer-to-Peer File Synchronization > Syncthing is a continuous file synchronization tool that syncs files between devices directly — no cloud, no servers, no accounts. Encrypted, private, and decentralized. ## Install Save as a script file and run: ## Quick Use ```bash # Linux/macOS curl -s https://api.github.com/repos/syncthing/syncthing/releases/latest | grep browser_download_url | grep linux-amd64 | head -1 | cut -d'"' -f4 | xargs curl -L -o syncthing.tar.gz tar xzf syncthing.tar.gz && cd syncthing-*/ ./syncthing # Or Docker docker run -d --name syncthing -p 8384:8384 -p 22000:22000/tcp -p 22000:22000/udp -v syncthing-config:/var/syncthing/config -v /path/to/sync:/var/syncthing/data syncthing/syncthing:latest ``` Open `http://localhost:8384` — add devices and select folders to sync. ## Intro **Syncthing** is an open-source, peer-to-peer continuous file synchronization tool. Unlike Dropbox or Google Drive, Syncthing syncs files directly between your devices without routing through any cloud server — your data never leaves your network, and no third party has access to your files. With 81.6K+ GitHub stars and MPL-2.0 license, Syncthing is one of the most popular open-source tools on GitHub, trusted by millions of users for private, secure file synchronization. ## What Syncthing Does - **Direct Sync**: Files sync directly between devices — no cloud server intermediary - **End-to-End Encryption**: All communication encrypted with TLS 1.3 - **No Account Required**: No signup, no login, no cloud subscription - **Cross-Platform**: Windows, macOS, Linux, Android, FreeBSD, Solaris - **Selective Sync**: Choose which folders to sync on each device - **Versioning**: File versioning with configurable retention (trash can, simple, staggered) - **Ignore Patterns**: .stignore files for excluding files/folders (like .gitignore) - **Conflict Resolution**: Automatic conflict detection with both versions preserved - **NAT Traversal**: Works through firewalls with relay fallback - **Web UI**: Beautiful management interface at localhost:8384 ## Architecture ``` ┌──────────────┐ ┌──────────────┐ │ Device A │◄─────────▶│ Device B │ │ (Desktop) │ Direct │ (Laptop) │ │ Syncthing │ P2P │ Syncthing │ └──────┬───────┘ └──────────────┘ │ │ Direct P2P │ ┌──────┴───────┐ │ Device C │ │ (Phone) │ │ Syncthing │ └──────────────┘ No central server. All devices connect directly. If direct connection fails → encrypted relay. ``` ## Self-Hosting ### Docker Compose ```yaml services: syncthing: image: syncthing/syncthing:latest hostname: my-syncthing ports: - "8384:8384" # Web UI - "22000:22000/tcp" # Sync protocol - "22000:22000/udp" # QUIC sync - "21027:21027/udp" # Discovery volumes: - syncthing-config:/var/syncthing/config - /path/to/documents:/var/syncthing/Documents - /path/to/photos:/var/syncthing/Photos environment: PUID: 1000 PGID: 1000 restart: unless-stopped volumes: syncthing-config: ``` ## Key Features ### Folder Configuration ``` Folder Types: ├── Send & Receive — Full two-way sync (default) ├── Send Only — This device is the "master" copy └── Receive Only — This device only receives updates Versioning: ├── Trash Can — Deleted/replaced files moved to .stversions/ ├── Simple — Keep N old versions ├── Staggered — Keep versions at increasing intervals └── External — Run custom script on file changes ``` ### .stignore (Exclusion Patterns) ``` // .stignore file (?d).DS_Store (?d)Thumbs.db (?d)desktop.ini node_modules .git *.tmp *.log ~* ``` ### Multi-Device Setup ``` Step 1: Install Syncthing on Device A Step 2: Install Syncthing on Device B Step 3: On Device A, click "Add Remote Device" Step 4: Enter Device B's ID (shown in Device B's web UI) Step 5: Accept connection on Device B Step 6: Share folders between devices ``` Device IDs are automatically generated cryptographic identifiers — no passwords to share. ### Use Cases | Scenario | Setup | |----------|-------| | Laptop ↔ Desktop sync | Send & Receive on both | | Phone photo backup | Send Only on phone, Receive Only on server | | Team shared folder | Send & Receive on all team devices | | NAS backup | Send Only from source, Receive Only on NAS | | Dotfiles sync | Sync ~/.config across Linux machines | ## Syncthing vs Alternatives | Feature | Syncthing | Dropbox | Resilio Sync | Nextcloud | |---------|----------|---------|-------------|-----------| | Open Source | Yes (MPL-2.0) | No | No | Yes | | P2P (no server) | Yes | No | Yes | No (server) | | Cloud storage | No | Yes (cloud) | No | Self-hosted | | Encryption | E2E (TLS) | At rest | E2E | At rest | | Account needed | No | Yes | Yes | Yes | | File versioning | Yes | 30-day | Yes | Yes | | Mobile | Android | iOS+Android | iOS+Android | iOS+Android | | iOS app | Community (Möbius) | Official | Official | Official | ## 常见问题 **Q: 没有中心服务器,设备怎么找到彼此?** A: Syncthing 使用全局发现服务器(仅用于交换 IP 地址,不传输文件)和本地网络发现(mDNS)。设备找到彼此后直接建立 P2P 连接。如果直连失败,会通过加密中继服务器转发。 **Q: iOS 支持吗?** A: 官方没有 iOS 应用(Apple 对后台同步限制严格)。社区项目 Möbius Sync 提供 iOS 客户端。如果 iOS 同步是刚需,考虑 Nextcloud 或 Resilio。 **Q: 能同步多大的文件/多少文件?** A: 没有限制。用户报告成功同步数百 GB 甚至 TB 级数据。数百万文件的同步也可以正常工作,但初始扫描可能需要较长时间。 ## 来源与致谢 - GitHub: [syncthing/syncthing](https://github.com/syncthing/syncthing) — 81.6K+ ⭐ | MPL-2.0 - 官网: [syncthing.net](https://syncthing.net) --- Source: https://tokrepo.com/en/workflows/a1ace164-34d0-11f1-9bc6-00163e2b0d79 Author: Script Depot