Skip to content

Syncthing VM Setup ​

This Ubuntu VM receives synchronized files and stores them on the NAS. It needs a real storage mount before Syncthing starts so missing NAS storage cannot redirect writes to its small system disk.

Prepare the physical Proxmox host first. For host-specific accounts, scripted setup, and AI recovery procedures, see Syncthing VM · Internal Operations.

For another homelab, choose unused guest IDs and addresses, your own gateway and DNS, and storage sized for your workload. Confirm actual inventory and DHCP assignments before creation; a failed ping alone does not prove an address is free.

Guest configuration ​

SettingThis homelab
VM ID / hostname104 / syncthing
OSUbuntu Server 24.04 LTS
CPU / RAM2 cores / 2 GB
Virtual disk32 GB, local guest storage
Address / gateway10.120.40.104/24 / 10.120.40.1
NAS10.120.40.6, share Personal-Drive
StartupStart at boot, with NAS dependency handling

Create and install Ubuntu ​

Create a VM in Proxmox with the resources above, a VirtIO network interface on the intended server network, and QEMU Guest Agent enabled. Install a verified Ubuntu Server ISO, configure the static address and a reachable DNS resolver, and create a normal sudo-capable account. Keep its username in your private configuration.

Reserve or exclude the guest address in DHCP. Remove the ISO from the boot path and verify hostname, address, gateway, and DNS inside the installed system. Inspect actual disk and filesystem sizes: a 32 GB virtual disk can contain a smaller root logical volume, so monitor free space rather than assuming all capacity is assigned.

sh
sudo apt update
sudo apt full-upgrade
sudo apt install ca-certificates cifs-utils curl gnupg jq openssh-server qemu-guest-agent
sudo systemctl start qemu-guest-agent
sudo systemctl enable --now ssh

This guest runs Syncthing natively and does not require Docker.

Configure administrative access ​

Create a normal sudo-capable administrator account during installation or from the initial console. Store its password securely. Install only your intended public SSH key while preserving existing keys, then prove a fresh key-authenticated session before disabling password and keyboard-interactive authentication. Inspect sshd -T, validate with sshd -t, and reload ssh.service while keeping the initial session and Proxmox console available.

For a new guest with a proven non-root administrative account, an early SSH drop-in can use:

text
PubkeyAuthentication yes
PasswordAuthentication no
KbdInteractiveAuthentication no
PermitRootLogin no

Verify a new key login succeeds and password-based login is rejected. The exact lab usernames and reviewed policy files are internal. Do not apply a root-login restriction before a non-root administrator and recovery path work.

Configure data storage ​

NAS storage is optional for a new deployment; local Linux storage can be used instead. For local storage, choose a data directory owned by the service account and skip the CIFS automount and CIFS-specific guard. Plan an independent backup either way.

The following example uses /mnt/sync-data as a portable mount path. The lab's actual mount path and private folder mappings are in the internal runbook. Use one chosen path consistently in fstab, systemd, and Syncthing.

Create /etc/samba/credentials/sync-data with your NAS username and password fields. Keep the directory root-only and the credential file root-owned with mode 0600. Store the source credentials in a password manager, not in fstab or shell history.

sh
sudo install -d -m 0700 /etc/samba/credentials
sudoedit /etc/samba/credentials/sync-data
sudo chmod 600 /etc/samba/credentials/sync-data
sudo mkdir -p /mnt/sync-data
id

Use the service account's actual numeric UID/GID instead of the example 1000:1000. Add to /etc/fstab:

text
//10.120.40.6/Personal-Drive /mnt/sync-data cifs credentials=/etc/samba/credentials/sync-data,uid=1000,gid=1000,file_mode=0664,dir_mode=0775,iocharset=utf8,vers=3.1.1,_netdev,nofail,x-systemd.automount,x-systemd.mount-timeout=30s,nosuid,nodev,noexec 0 0

nofail keeps the VM bootable when the NAS is absent. Automount defers the share connection until access; noexec/nosuid/nodev limit execution-related behavior on this data mount. For another NAS, use its supported SMB dialect and share permissions.

sh
sudo findmnt --verify --verbose
sudo systemctl daemon-reload
sudo systemctl start 'mnt-sync\x2ddata.automount'

Quote escaped systemd unit names so the shell preserves their backslashes. Obtain exact names with systemd-escape --path --suffix=automount /mnt/sync-data.

Trigger the mount by accessing a known existing child directory, then inspect that child with findmnt -T /mnt/sync-data/<existing-directory>. Confirm the expected CIFS source, not the local root filesystem or only an autofs layer. Verify the service account can write the chosen destination.

Install a storage guard ​

Install the Syncthing package before enabling its service. For a NAS-backed setup, create /etc/systemd/system/[email protected]/storage.conf with:

ini
[Unit]
Wants=network-online.target
After=network-online.target
RequiresMountsFor=/mnt/sync-data

[Service]
ExecStartPre=/bin/sh -c 'ls -d /mnt/sync-data/<existing-directory> >/dev/null && findmnt -T /mnt/sync-data/<existing-directory> -n -o FSTYPE | grep -qx cifs'

Replace <existing-directory> with a real child path and adapt the mount path. Create the drop-in directory first, then run sudo systemctl daemon-reload. The guard must succeed before enabling the native service. It triggers the automount and rejects a fallback to the local disk.

The physical host also gates storage-dependent guest startup in this lab. Preserve that integration and the in-guest guard. A Proxmox NAS backup storage entry does not automatically mount the data share inside this VM.

Continue with Syncthing configuration for service-account selection, GUI authentication, proxy setup, device pairing, and folder/versioning policy.

Backups and startup checks ​

Set Start at boot deliberately and preserve the physical host's coordinated startup behavior. Configure a protected off-host Proxmox backup with a schedule and retention appropriate to the guest, then test restoration without creating a duplicate active address or identity.

After initial setup or a controlled reboot, confirm network configuration, DNS, key-only access, service health, and the application's primary function. Keep the Proxmox guest console as an out-of-band recovery path. Inspect active backup and storage tasks before maintenance; avoid hard power removal.