Repository navigation
smb: save the user name in the config even if it matches the current user - fixes #9356 - #9945
Merged
Merged
Conversation
Member
|
Can you fix up the conflict, then I'll merge - thanks! |
hsdfat
force-pushed
the
smb-default-user-9356
branch
from
September 19, 2026 14:57
aeacb6b to
4c4d4e8
Compare
…user - fixes rclone#9356 The default for --smb-user was the name of the user running rclone config, and rclone does not write defaults to the config file, so entering your own user name left it out. A remote made that way then logged in as whoever ran it later, e.g. root under systemd. Make the default blank and look up the current user when the remote is used, as the ftp backend does. Existing configs work as before.
hsdfat
force-pushed
the
smb-default-user-9356
branch
from
September 21, 2026 06:49
270621f to
972d600
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this change do?
This implements the suggestion in the issue: the default for
--smb-userbecomes blank, and a blank user isresolved to the current user name when the remote is used.
The default used to be the name of the user running
rclone config. Since rclone doesn't write default values tothe config file, typing your own user name at the prompt left it out of the config, and the remote then logged in
as whoever ran it later - root under a systemd mount. With a blank default, a name typed at the prompt is always
saved, and pressing Enter leaves it blank as before.
Existing configs behave the same: a remote with no
userstill logs in as the current user, and an explicit useris unchanged. The ftp backend already resolves a blank user this way.
A blank
user =line in the config file was already ignored, so that falls back to the current user as before.The one difference is an explicitly empty user from somewhere else -
--smb-user "",RCLONE_SMB_USER=or:smb,user='':- which used to send an empty user name and now sends the current user's. The SMB docs already sayanonymous login isn't supported and to use
guestinstead.sftp has the same kind of default and could get the same change, but its user handling interacts with the
sshoption, so I've left it for a separate PR if you'd like one.
Testing
TestNewFsUser: a blank or missing user resolves to the current user, and an explicit one is kept.TestUserDefault: the option default is blank.Both fail on master. I also ran the interactive
rclone configfrom the issue with the new binary: typing thecurrent user name now writes
user = <name>, and pressing Enter leaves it out.go build ./...,make quicktestandgolangci-lint run ./backend/smb/pass, andgo run ./fstest/test_all -backends smbpasses against the docker test servers.Linked issue
Fixes #9356
Checklist
test_allpasses for this backend and if submitting a new backend can provide a test account for the integration tester - see CONTRIBUTING.md.