GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — smb: save the user name in the config even if it matches the current user - fixes #9356 by hsdfat · Pull Request #9945 · rclone/rclone

Conversation

@hsdfat

@hsdfat hsdfat commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

What does this change do?

This implements the suggestion in the issue: the default for --smb-user becomes blank, and a blank user is
resolved 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 to
the 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 user still logs in as the current user, and an explicit user
is 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 say
anonymous login isn't supported and to use guest instead.

sftp has the same kind of default and could get the same change, but its user handling interacts with the ssh
option, 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 config from the issue with the new binary: typing the
current user name now writes user = <name>, and pressing Enter leaves it out.

go build ./..., make quicktest and golangci-lint run ./backend/smb/ pass, and
go run ./fstest/test_all -backends smb passes against the docker test servers.

Linked issue

Fixes #9356

Checklist

  • This change is trivial OR it has been discussed and agreed in the linked issue.
  • I have read the contribution guidelines.
  • (If I used AI tools to help write this code) I have read and understood the AI-assisted contributions guidance, and I have tested and take ownership of this change myself.
  • I have added tests for all changes in this PR if appropriate.
  • I have added documentation for the changes if appropriate. (The option help says a blank user means the current user.)
  • All commit messages are in house style.
  • (Backend changes only) test_all passes for this backend and if submitting a new backend can provide a test account for the integration tester - see CONTRIBUTING.md.
  • This Pull Request is ready for review.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@hsdfat
hsdfat requested a review from ncw as a code owner September 18, 2026 21:03
ncw
ncw approved these changes Sep 19, 2026
View reviewed changes

@ncw ncw left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect - thank you :-)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@ncw

ncw commented Sep 19, 2026

Copy link
Copy Markdown
Member

Can you fix up the conflict, then I'll merge - thanks!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@hsdfat
hsdfat force-pushed the smb-default-user-9356 branch from aeacb6b to 4c4d4e8 Compare September 19, 2026 14:57
@hsdfat
smb: save the user name in the config even if it matches the current …
972d600
…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
hsdfat force-pushed the smb-default-user-9356 branch from 270621f to 972d600 Compare September 21, 2026 06:49
@ncw
ncw merged commit 3c51b96 into rclone:master Sep 21, 2026
9 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@hsdfat
hsdfat deleted the smb-default-user-9356 branch November 6, 2026 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@ncw ncw ncw approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

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

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@hsdfat @ncw
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.