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
{{ message }}
Repository navigation
The configuration editor drops SMB usernames when they are equal to the username of the user, making usage of the same in systemd more difficult #9356
When creating a remote of type smb, the configuration editor will not output the provided SMB username to the configuration file if it happens to be equal to that of the running user. Presumably, the rationale for this is that rclone can and will look up the username of the running user at remote usage time if one is not present in the configuration file. However, this makes it difficult to create systemd mount configurations for the same. systemd mount configurations will run as root. rclone will therefore send the username root to the SMB server, which will cause an authentication failure.
My current workaround is to manually edit the configuration file printed by $ rclone config file to include an explicit user = $MYUSERNAME line in the section for my SMB remote.
How do you think rclone should be changed to solve that?
In descending order of preference:
rclone should always output the SMB username to the configuration file, even if it happens to equal the username of the local account creating the configuration file. This makes configuration files containing SMB remotes more portable at the cost of a marginal increase in configuration file size for users who happen to have local usernames equal to their SMB usernames.
rclone could output an SMB username that is equal to the username of the local account creating the configuration only if the full username is explicitly specified by the user. When the user simply hits Enter on the username prompt in the configuration editor, rclone could continue to elide the SMB username from the configuration file and look it up at remote usage time. This would prevent increases to the configuration file size for users that have a local username matching their SMB username while providing an escape hatch for users that have a local username matching their SMB username and who wish to create systemd mount configurations for their SMB remotes, but is more confusing in the general case.
The rclone docs for the smb share type could be updated to note this edge case, and warn users about the danger.
In any scenario, it's probably best to keep the behavior of looking up the username at remote usage time to avoid breaking existing users with an smb remote configured that does not contain an SMB username.
How to use GitHub
Please use the 👍 reaction to show that you are affected by the same issue.
Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
Subscribe to receive notifications on status change and new comments.
This is quite deeply embedded into the rclone config system. Namely rclone doesn't write the defaults into the config file. Since the default is set to the current user, it never gets written to the config file.
We can't change that mechanism without breaking stuff and we can't change the default user for the smb backend without breaking existing configs.
Can't think of a sensible fix other than documenting the problem.
Change whatever existing logic looks like if (/* option is not set to default */) { /* write option */} to if (/* option is not set to default OR persist default values for this option */) { /* write option */ } (I tried to find where this logic lives, but failed)
If that's not possible, or if doing that would be a less simple fix, the proposed fix in #9356 (comment) also sounds reasonable to me.
I note that there are other backends which could use this fix like sftp and probably others
Yeah, it looks like the ftp and sftp backends also use the env.currentUser function and might also benefit from a fix.
Activity
ncw commentedon Apr 19, 2026
This is quite deeply embedded into the rclone config system. Namely rclone doesn't write the defaults into the config file. Since the default is set to the current user, it never gets written to the config file.
We can't change that mechanism without breaking stuff and we can't change the default user for the smb backend without breaking existing configs.
Can't think of a sensible fix other than documenting the problem.
Any ideas?
ncw commentedon Apr 20, 2026
Ok here is an idea
That would be backwards compatible and allow you to chose your username explicitly.
How does that sound?
I note that there are other backends which could use this fix like sftp and probably others
electric-sheepgirl commentedon Apr 20, 2026
That makes sense, but is it possible (and simpler) to change that mechanism for just this parameter? Something like:
Optionstruct named something likepersistDefaultuserparam in thesmbbackendif (/* option is not set to default */) { /* write option */}toif (/* option is not set to default OR persist default values for this option */) { /* write option */ }(I tried to find where this logic lives, but failed)If that's not possible, or if doing that would be a less simple fix, the proposed fix in #9356 (comment) also sounds reasonable to me.
Yeah, it looks like the
ftpandsftpbackends also use theenv.currentUserfunction and might also benefit from a fix.smb: save the user name in the config even if it matches the current …
smb: save the user name in the config even if it matches the current …
ncw commentedon Sep 21, 2026
I've merged @hsdfat fix for this this to master now which means it will be in the latest beta in 15-30 minutes and released in v1.76
smb: save the user name in the config even if it matches the current …
smb: save the user name in the config even if it matches the current …
smb: save the user name in the config even if it matches the current …
smb: save the user name in the config even if it matches the current …