SFTP user parsing as CLI argument broken

What is the problem you are having with rclone?

Hello there,

I'm currently trying to migrate from sshfs to using rclone in conjunction with it's sftp backend. For this purpose I have created a sort of sftp template. Which looks like this.

$ cat ~/.config/rclone/rclone.conf 
[template-sftp]
type = sftp
host = localhost
user = username
key_file = ~/.ssh/id_ed25519
known_hosts_file = ~/.ssh/known_hosts
host_key_algorithms = ssh-ed25519 ssh-rsa ecdsa-sha2-nistp256
shell_type = unix
disable_hashcheck = true

The plan is to run rclone like this: rclone mount template-sftp: ~/remote --sftp-host=<remote host> --sftp-user=<remote user>

This works pretty well, but not quite.

This here works flawlessly.

$ rclone -vv mount template-sftp: /home/liquid/remote --sftp-host=audioserver.entropy --sftp-user=audiodaemon
2026/06/22 21:16:33 DEBUG : rclone: Version "1.74.1" starting with parameters ["rclone" "-vv" "mount" "template-sftp:" "/home/liquid/remote" "--sftp-host=audioserver.entropy" "--sftp-user=audiodaemon"]
2026/06/22 21:16:33 DEBUG : Creating backend with remote "template-sftp:"
2026/06/22 21:16:33 DEBUG : Using config file from "/home/liquid/.config/rclone/rclone.conf"
2026/06/22 21:16:33 DEBUG : template-sftp: detected overridden config - adding "{QCx-1}" suffix to name
2026/06/22 21:16:33 DEBUG : sftp://audiodaemon@audioserver.entropy:22/: New connection 192.168.0.105:49768->192.168.0.101:22 to "SSH-2.0-OpenSSH_10.3"
...

When using a different machine, it fails:

$ rclone -vv mount template-sftp: /home/liquid/remote --sftp-host=leena.entropy --sftp-user=liquid
2026/06/22 18:27:24 DEBUG : rclone: Version "1.74.1" starting with parameters ["rclone" "-vv" "mount" "template-sftp:" "/home/liquid/remote" "--sftp-host=leena.entropy" "--sftp-user=liquid"]
2026/06/22 18:27:24 DEBUG : Creating backend with remote "template-sftp:"
2026/06/22 18:27:24 DEBUG : Using config file from "/home/liquid/.config/rclone/rclone.conf"
2026/06/22 18:27:24 DEBUG : template-sftp: detected overridden config - adding "{AGoNy}" suffix to name
2026/06/22 18:27:24 DEBUG : pacer: low level retry 1/10 (error couldn't connect SSH: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain)
2026/06/22 18:27:24 DEBUG : pacer: Rate limited, increasing sleep to 200ms
2026/06/22 18:27:24 DEBUG : pacer: low level retry 2/10 (error couldn't connect SSH: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain)
2026/06/22 18:27:24 DEBUG : pacer: Rate limited, increasing sleep to 400ms

This is not a credential problem. The problem is due rclone not using the correct username. Inspecting the SSH log on the server I can see that the login is attempted using username as username. I.e. the content of the config file. The --sftp-user= argument here seems to be completely ignored.

Now the weirdest part. This here works:

$ env RCLONE_SFTP_USER=liquid rclone -vv mount template-sftp: /home/liquid/remote --sftp-host=leena.entropy
2026/06/22 20:59:20 DEBUG : Setting --sftp-user "liquid" from environment variable RCLONE_SFTP_USER="liquid"
2026/06/22 20:59:20 DEBUG : rclone: Version "1.74.1" starting with parameters ["rclone" "-vv" "mount" "template-sftp:" "/home/liquid/remote" "--sftp-host=leena.entropy"]
2026/06/22 20:59:20 DEBUG : Creating backend with remote "template-sftp:"
2026/06/22 20:59:20 DEBUG : Using config file from "/home/liquid/.config/rclone/rclone.conf"
2026/06/22 20:59:20 DEBUG : Setting sftp user="liquid" from environment variable RCLONE_SFTP_USER
2026/06/22 20:59:20 DEBUG : template-sftp: detected overridden config - adding "{cT7Dl}" suffix to name
2026/06/22 20:59:20 DEBUG : Setting sftp user="liquid" from environment variable RCLONE_SFTP_USER
2026/06/22 20:59:20 DEBUG : sftp://liquid@leena.entropy:22/: New connection 192.168.0.105:41018->192.168.0.100:22 to "SSH-2.0-OpenSSH_10.3"
2026/06/22 20:59:20 DEBUG : sftp://liquid@leena.entropy:22/: Shell type "unix" from config
2026/06/22 20:59:20 DEBUG : sftp://liquid@leena.entropy:22/: Relative path resolved to "/home/liquid"
...

I really can't wrap my head around this. Why does rclone consider the --sftp-user argument for the one machine, but completely ignores it for the other one. But then chooses to use it after all, when passing the user through an environment variable?

Sadly I'm not fluent enough in Go to figure out where to look.

Thanks in advance!

Run the command 'rclone version' and share the full output of the command.

$ rclone version
rclone 1.74.1
- os/version: gentoo 2.18 (64 bit)
- os/kernel: 6.18.35-gentoo-r1 (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.26.3-X:nodwarf5
- go/linking: dynamic
- go/tags: none

Which cloud storage system are you using? (eg Google Drive)

Using the sftp backend.

The command you were trying to run (eg rclone copy /tmp remote:tmp)

rclone mount

Please see the detail above.

The rclone config contents with secrets removed.

I pasted the config above. No secrets in the file to begin with.

A log from the command with the -vv flag

Log can also be found above.

I think this is a subtle bug in rclone.

The problem is that on the second machine the users login name is liquid (judging by the /home/liquid) which is the same as --sftp-user=liquid. The --sftp-user defaults to the current user and rclone ignores trying to set it to the default liquid value.

This works with environmental variables because they set the default, changing it away from liquid.

Not sure if that makes sense (it is late!) but I'd be grateful if you could report this on GitHub so we can fix it properly.

Thanks

Hey Nick,

thanks for the reply. I'm not sure I follow you here.

The rclone docs clearly states that arguments provided by the commandline should override any default values or values from the config file. That just doesn't seem to be the case here though. Or maybe I completely misunderstand the document?

I agree though that there seems to be some subtle interaction between the local username (the one that calls rclone) and the SFTP user that you want to use for the login on the remote system.

Anyway, concerning the bugreport. For various reasons (please don't ask) I have parted with GitHub recently. No longer have an account there, so I'm afraid I won't be making any bug report here.

This is a simple fix luckily.

Please give this a try

v1.75.0-beta.9828.d039cbfe7.fix-default-options on branch fix-default-options (uploaded in 15-30 mins)

Update that didn't build, try this instead

v1.75.0-beta.9828.437dc4563.fix-default-options on branch fix-default-options (uploaded in 15-30 mins)