You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The question of how to setup rclone for use with the WinFsp Launcher often comes up in this forum and elsewhere. I am opening this issue primarily to address this question, but also to request that rclone natively supports the creation of the necessary registry entries to be used by the WinFsp Launcher.
What is your current rclone version (output from rclone version)?
(Via chocolatey)
rclone v1.48.0
- os/arch: windows/amd64
- go version: go1.12.3
What problem are you are trying to solve?
Users often ask how to setup rclone mount so that they can "map" it as a network drive (via the Explorer or the net use command) or how to setup rclone mount to run under the SYSTEM account. The WinFsp Launcher can be used to support such scenarios; however setting up the Launcher for rclone mount is not straightforward, both because it requires users to make direct registry changes, but also because rclone mount does not understand the default command lines that the Launcher uses to launch file systems.
How do you think rclone should be changed to solve that?
The most recent Beta release of WinFsp (2019.3 B2 / v1.5B2) has added the Launcher ability to rewrite paths passed to the file system during launch. For example this allows a UNC path of \rclone\REMOTE\PATH\TO\FILES to be rewritten to REMOTE:PATH/TO/FILES before being passed to rclone mount. This eliminates the need for rclone mount to support the native UNC syntax in its command line. I discuss this in Path Rewriting below.
Furthermore rclone could be enhanced to have the ability to add the necessary Launcher registry entries during rclone config. I discuss this in Registry Entries further below.
Path Rewriting
For reference in the following, I am assuming that the user issued the command: net use y: \\rclone\REMOTE\PATH\TO\FILES. Assuming that the Launcher is properly configured to handle \rclone prefixes, it will pass the following arguments to the file system:
%1: UNC path used in the net use command with a single backslash: \rclone\REMOTE\PATH\TO\FILES
%2: drive used in the net use command: y:
%U: user name of the user that issued the net use command in DOMAIN\USERNAME format: e.g. WINDOWS\billziss
The latest Launcher (2019.3 B2 / v1.5B2 or later) includes the ability to rewrite these paths in a format that rclone mount accepts:
%\/b:_1: rewrite the path \rclone\REMOTE\PATH\TO\FILES to REMOTE:PATH/TO/FILES. This works as follows:
%\: introduces a path rewriting rule
/: defines a "replacement path separator"
b: the original UNC path (\rclone\REMOTE\PATH\TO\FILES) is broken down into path components using backslash (\) as a separator. The first path component is referenced by the symbol a, the second one by the symbol b, etc. So in our example, a would be rclone, b would be REMOTE, c would be PATH, d would be TO, and z would be the empty string.
:: is a literal symbol that is output when the path is rewritten.
_: means the "rest of the path". In this case because we used the symbol b, the "rest of the path" is everything after b (PATH\TO\FILES). The "replacement path separator" is used to replace all backslashes found within _, thus PATH\TO\FILES becomes PATH/TO/FILES.
1: end the rule and apply it to the first argument (%1).
%\\_U: rewrite the string DOMAIN\USERNAME to DOMAIN\\USERNAME.
This is necessary because FUSE option parsing uses the backslash as an escape character in -o UserName=DOMAIN\\USERNAME.
%\/bU: rewrite the string DOMAIN\USERNAME to USERNAME.
With this we can now prepare the following command line for rclone mount:
mount %\/b:1 %2 -o VolumePrefix=%\/_1 -o UserName=%\\_U --config=C:\Users\\%\\/bU\.config\rclone\rclone.conf OTHER-ARGS
Registry Entries
With the above discussion in mind we can now determine the Launcher registry entries to create. These are presented below in .reg format, but with this issue I request that rclone adds the ability to produce these registry entries via rclone config or similar mechanism.
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\WinFsp\Services\rclone]
"Executable"="C:\\ProgramData\\chocolatey\\bin\\rclone.exe"
"CommandLine"="mount %\\/b:1 %2 -o VolumePrefix=%\\/_1 -o UserName=%\\\\_U --config=C:\\Users\\\\%\\/bU\\.config\\rclone\\rclone.conf"
"Security"="D:P(A;;RPWPLC;;;WD)"
With these registry entries I can now map a network drive from Explorer:
The text was updated successfully, but these errors were encountered:
The question of how to setup rclone for use with the WinFsp Launcher often comes up in this forum and elsewhere. I am opening this issue primarily to address this question, but also to request that rclone natively supports the creation of the necessary registry entries to be used by the WinFsp Launcher.
What is your current rclone version (output from
rclone version
)?(Via chocolatey)
What problem are you are trying to solve?
Users often ask how to setup
rclone mount
so that they can "map" it as a network drive (via the Explorer or thenet use
command) or how to setuprclone mount
to run under the SYSTEM account. The WinFsp Launcher can be used to support such scenarios; however setting up the Launcher forrclone mount
is not straightforward, both because it requires users to make direct registry changes, but also becauserclone mount
does not understand the default command lines that the Launcher uses to launch file systems.How do you think rclone should be changed to solve that?
The most recent Beta release of WinFsp (2019.3 B2 / v1.5B2) has added the Launcher ability to rewrite paths passed to the file system during launch. For example this allows a UNC path of
\rclone\REMOTE\PATH\TO\FILES
to be rewritten toREMOTE:PATH/TO/FILES
before being passed torclone mount
. This eliminates the need forrclone mount
to support the native UNC syntax in its command line. I discuss this in Path Rewriting below.Furthermore rclone could be enhanced to have the ability to add the necessary Launcher registry entries during
rclone config
. I discuss this in Registry Entries further below.Path Rewriting
For reference in the following, I am assuming that the user issued the command:
net use y: \\rclone\REMOTE\PATH\TO\FILES
. Assuming that the Launcher is properly configured to handle\rclone
prefixes, it will pass the following arguments to the file system:%1
: UNC path used in thenet use
command with a single backslash:\rclone\REMOTE\PATH\TO\FILES
%2
: drive used in thenet use
command:y:
%U
: user name of the user that issued thenet use
command inDOMAIN\USERNAME
format: e.g.WINDOWS\billziss
The latest Launcher (2019.3 B2 / v1.5B2 or later) includes the ability to rewrite these paths in a format that
rclone mount
accepts:%\/b:_1
: rewrite the path\rclone\REMOTE\PATH\TO\FILES
toREMOTE:PATH/TO/FILES
. This works as follows:%\
: introduces a path rewriting rule/
: defines a "replacement path separator"b
: the original UNC path (\rclone\REMOTE\PATH\TO\FILES
) is broken down into path components using backslash (\
) as a separator. The first path component is referenced by the symbola
, the second one by the symbolb
, etc. So in our example,a
would berclone
,b
would beREMOTE
,c
would bePATH
,d
would beTO
, andz
would be the empty string.:
: is a literal symbol that is output when the path is rewritten._
: means the "rest of the path". In this case because we used the symbolb
, the "rest of the path" is everything afterb
(PATH\TO\FILES
). The "replacement path separator" is used to replace all backslashes found within_
, thusPATH\TO\FILES
becomesPATH/TO/FILES
.1
: end the rule and apply it to the first argument (%1
).%\\_U
: rewrite the stringDOMAIN\USERNAME
toDOMAIN\\USERNAME
.-o UserName=DOMAIN\\USERNAME
.%\/bU
: rewrite the stringDOMAIN\USERNAME
toUSERNAME
.With this we can now prepare the following command line for
rclone mount
:Registry Entries
With the above discussion in mind we can now determine the Launcher registry entries to create. These are presented below in
.reg
format, but with this issue I request that rclone adds the ability to produce these registry entries viarclone config
or similar mechanism.With these registry entries I can now map a network drive from Explorer:
The text was updated successfully, but these errors were encountered: