Installing rclone mount on Windows as service?

According to the rclone mount document:
“It is also possible to start a drive from the SYSTEM account (using the WinFsp.Launcher infrastructure) which creates drives accessible for everyone on the system.”

I tried to edit the registry for WinFsp.Launcher to include rclone but it didn’t work. Anyone with experience or instruction about how to make Windows 10 system launch rclone mount as a service?

(I need this because some old apps need to run as Administrator on Windows 10, while some others such as Windows Explorer are more troublesome to run as Administrator on Windows 10, while not impossible. For example, I used autohotkey to launch Windows Explorer as Administrator on Windows for the Win E key, but it’s not reliable. Anyway the rclone mounted drive needs to be accessible by both normal user and Adm account, hence the question.)

https://nssm.cc/usage

Might be useful.

1 Like

nssm works! It simply works! Thank you spicypixel!

Now my mounted rclone Google drive on Windows can be seen by both the user accounts and administrator account.

It’s quite straightforward. The following experience for others in case useful, while most people would be able to figure them out fairly easily:

  • To install the rclone service, need to specify the config file location in the parameter, because it’s starting from the system account, not a user account.
  • It might also help to configure the timeout for shutting down and restart the service longer. I set it as 10 seconds and have no problem so far.
  • To change the parameters of rclone after installation, use regedit.exe to edit the registry:
    \HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\RCLONE SERVICE NAME\Parameters
    (Browse to it or simply search the keyword of your rclone service in the registry.)
1 Like

hi
can you please detail the steps you used with nssm to mount Rclone in windows as a service because i was not able to find the correct way ?
thank you

hi mfmaa03,

You can simply follow the instructions here:

After downloading nssm, I simply put nssm.exe in the same folder as rclone. Then, I use the nssm GUI to configure rclone as a Windows service:
nssm GUI
Remember to put all the rclone arguments in the “Arguments” field.

Note that when registering rclone as a Windows service, you need to explicitly specify the location of rclone’s config file (e.g. --config=“C:\Program Files\rclone\rclone.conf” ), because rclone is being started by the system account, not a user account anymore, so the default folder for conf file could be different from where you used to put the config file before.

After the configuration, it will automatically start upon reboot. You can also run “services.msc” to stop/start/restart the service whenever you want.

1 Like

thank you for the reply:
my rclone config file is located here should i move at to the main rclone folder with NSSM ?
C:\Users*******.config\rclone
and do i put the command for rclone mount in the config file or in NSSM ?
Can you show me a screen shot of how you are doing at in more detail ?
sorry for all the small questions but this is very new to me.

I was able to get this working.

Copy nssm.exe to same directory that rclone is in. I launched NSSM, by opening an elevated command line. Type cmd in the search bar and right click and choose “run as administrator.”

  1. cd c:\rclone (or wherever you have rclone located)
  2. nssm install “Rclone Mount”
  3. Fill in the info below
  4. Still in the command prompt, type services.msc
  5. Scroll down and choose your service and right click and start it.
  6. If it fails to start, stop the service
  7. Go back to command prompt and run sc.exe delete “Rclone Mount”
  8. Enter the command from step 2 above and repeat until you complete everything with no typos and it works.

Going to post the various parts of NSSM that I’ve filled in. Originally it was failing because when I did the copy paste, for some reason it was doing one dash and one hyphen. I could paste it to command line and it would work. But to NSSM it would change it to hyphen. So I ended up just typing it out, instead of copy paste.

Application tab:
Path: C:\rclone\rclone.exe
Startup Directory: C:\rclone
Arguments: mount gdrive-crypt: s: --config “C:\rclone\rclone.conf”
Service name: Rclone Mount

Details tab:
Display name: Rclone Mount
Description: Automatically mounts the encrypted google drive using rclone.

Exit actions tab:
Delay restart by: 10000 ms (10 seconds)

If I didn’t reference it above, I didn’t change it away from defaults.

6 Likes

Five, thank you for the detailed instruction!

mfmaa03, you don’t need to move your config file. Just use the --config argument to tell rclone to look for the config file in the right directory. Even if you move your config file to the program directory, you still need to use the --config argument because the system account might look for the config file in another directory by default.

Thanks Five worked good

Another way way is to create a shortcut of your CMD.exe go to properties and in target type
C:\Windows\System32\cmd.exe -cmd /k cd c:/rclone2 & rclone mount gdrive: Q:

rclone2 beeing my folder , add that shortcut to your startup. but this leaves the cmd window open , there is a way to do this using powershell superuser i didn’t figure it out.

1 Like

How can I troubleshoot what I did wrong ?

I tried it like 30 times now and can not get it to work I always get an error from windows:

I used exactly the same as above (my nssm and rclone is in the same location as in the example etc.)

This is my arguments: mount gcrypt2: O: --config “C:\rclone\rclone.conf”

Everything typed in by hand.

2 Likes

I tried this as well. Just could not get it to work. Rclone service always goes into pause mode.

2 Likes