Thanks to @martijnsmith for giving me the boost needed to “how-to” this!
If want to run Duplicati as a Windows service instead of under a specific user account OR maybe you find that you keep getting errors such as the following, it could be that you’re running Duplicati under a user install for a non-administrator user.
System.UnauthorizedAccessException: Access to the path '<path>' is denied.
Firstly, congratulations on not doing everyday work as an administrator!
Secondly, disclaimers - running Duplicati under an elevated account (such as “Run as administrator” or as a system account service) gives it access to parts of the system most users can’t normally get to - including other user’s folders!
This means that anybody with access to the backup could be able to see AND RESTORE folder & file listings of other users. If that’s not an issue for you, then great - forge ahead!
Thirdly, you can likely resolve this issue in a few different ways, including:
- Run Duplicati as a service (the official way)
- Install and run Duplicati under an administrator account
- Update the Duplicati.GUI.TrayIcon.exe shortcut in your Startup folder to “Run this program as an administrator” (under the Compatibility tab of Properties)
Here we’re going to go over method #1.
- Stop the tray icon if you currently have it running
- Move the following from the “Src:” folder to the “Dst:” folder as shown bellow (use the “Prt:” folder if currently running in
--portable-mode). Note that you may be prompted to give yourself access to the second folder:
C:\Users\ [your user name]\AppData\Roaming\Duplicati(Alternatively replace Roaming with Local.)
C:\Program Files\Duplicati 2\Data)
- Open a command prompt as an administrator (right click and select “Run as administrator”) and run
Duplicati.WindowService.exe installin your Duplicati install folder (likely
"C:\Program Files\Duplicati 2\Duplicati.WindowsService.exe" install)
- If you get the “Installation has completed” message, you can start the service with
sc start Duplicati(or use a Windows Service GUI, your choice)
But if you get an error such as the following then you probably didn’t open your command prompt as an authorized administrator, try again
System.UnauthorizedAccessException: Access to the path 'C:\Program Files\Duplicati 2\Duplicati.WindowsService.InstallState' is denied.
- Once the service has been started go ahead and close the command prompt window (we’re done with it now)
- Open a browser window and go to http://localhost:8200 to make sure the service is working and found your existing settings (if that fails but http://localhost:8300 works, then you may have forgotten to stop the tray icon)
- The Tray icon is no longer needed so you can remove Duplicati from your Startup programs. However, if you like having the icon around then be sure to update the properties of any shortcuts to it (such as in the Startup folder) to include
--no-hosted-serverparameter as part of the Target field (this tells the Tray Icon to connect to the service instead of starting it’s own instance).
There you’re done! Duplicati should now run when the machine starts up whether or not a user is actually logged on.
A few final notes:
If you are using “User data” folders (or %my_documents%, %desktop%, etc.) in your Source note that these are dynamic and will change depending on the user account under which Duplicati is running, so if you set up these sources while logged in as “you” then change to the service you’ll get backups of the SERVICE account “My Documents”, “Desktop”, etc. To get around this, use full “Computer” paths (they should start with drive letters, “//”, or “\”).
An issue was found with the service based Duplicati with Minio:
Launch every night
To REMOVE the Duplicati service (not just turn it off) you run
Duplicati.WindowsServce.exe uninstallin your Duplicati install folder (so most likely something like
"C:\Program Files\Duplicati 2\Duplicati.WindowsService.exe" uninstall.
If you experience errors like this one: Found 240 remote files that are not recorded in local storage, please run repair it is likely that your backup databases are not moved properly. To fix this go to the “Database …” menu under Advanced settings per backup job. There you will find an option to change the “Local database path” to your new Duplicati folder, the Dst-folder from step 2. Be careful if you have already moved the backup database files, so that you do not overwrite the proper ones.