Configure Sync WebDAV to start automatically when your Linux computer boots, even before you log in. The server will run in the background using your saved Sync session.
Before you begin:
- Install Sync WebDAV and complete the initial sign-in. Follow the WebDAV Install Guide for Linux.
- Run the commands below using the same Linux account you used to install and sign in to Sync WebDAV.
These instructions use systemd and have been tested on Ubuntu. They should also work on other Linux distributions using systemd, provided Sync WebDAV is installed and working.
1. Set up automatic startup.
Stop any manually started copy of the WebDAV server.
- If it is running in Terminal, press Ctrl+C.
- If you started it with --daemon, run: pkill -TERM -u "$USER" -x sync-webdav
2. Create the startup configuration.
Open Terminal and paste this entire block:
mkdir -p ~/.config/systemd/user
cat > ~/.config/systemd/user/sync-webdav.service <<'EOF'
[Unit]
Description=Sync WebDAV Server
[Service]
Type=simple
RemainAfterExit=yes
WorkingDirectory=%h
ExecStart=%h/.sync-webdav/bin/sync-webdav --daemon
Restart=on-failure
RestartSec=15
[Install]
WantedBy=default.target
EOFThis assumes the default installation location. Add any options you normally use, such as --mount vault/, to the end of the ExecStart line.
3. Enable automatic startup and start the server.
Run:
sudo loginctl enable-linger "$USER"
systemctl --user daemon-reload
systemctl --user enable sync-webdav.service
systemctl --user restart sync-webdav.serviceEnter your Linux user password if prompted.
4. Confirm it works after restarting.
Restart your computer, then connect with your usual WebDAV client. You should be able to browse and open files without starting Sync WebDAV manually. Not when connecting with a client you'll be prompted to enter the WebDAV server username / password that was created during installation.
Manage the server
After completing the setup, use these commands to manage the server:
| Action | Command |
|---|---|
| Stop the server until you start it again or reboot | systemctl --user stop sync-webdav.service |
| Start the server | systemctl --user start sync-webdav.service |
| Restart the server | systemctl --user restart sync-webdav.service |
| Turn off automatic startup and stop the server | systemctl --user disable --now sync-webdav.service |
Troubleshooting
If your WebDAV client cannot connect after restarting, check whether the server responds:
curl -I http://127.0.0.1:4918/
-
HTTP response, such as
401 Unauthorized: The server is responding. A 401 is expected when no WebDAV credentials are provided. Connect with your client using the WebDAV username and password generated during setup. - Connection refused or failed to connect: The server is not accepting connections on that port. If you configured a different port, use that number instead.
View the startup logs for more information:
journalctl --user -u sync-webdav.service -b -n 30 --no-pager
About service status: With this configuration, active (exited) can be normal if the server has started in the background. It does not confirm the server is still running. Connect with your WebDAV client and open a file to confirm that the server and saved Sync session are working.