Rclone can't connect to smb share

What is the problem you are having with rclone?

Connecting to a specific samba share gives error. With other smb servers, the same config works. Connecting to the share with other smb clients works.

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

rclone v1.66.0
- os/version: alpine 3.19.1 (64 bit)
- os/kernel: 6.1.0-13-amd64 (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.22.1
- go/linking: static
- go/tags: none

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

SMB/CIFS and SFTP

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

rclone ls mysource:myshare -vv

Please run 'rclone config redacted' and share the full output. If you get command not found, please make sure to update rclone.

[mysource]
type = smb
host = XXX
user = XXX
pass = XXX

[mydest]
type = sftp
host = XXX
user = XXX
port = 22
pass = XXX
shell_type = unix
md5sum_command = md5sum
sha1sum_command = sha1sum

A log from the command that you were trying to run with the -vv flag

2024/06/07 16:51:43 DEBUG : rclone: Version "v1.66.0" starting with parameters ["rclone" "ls" "mysource:myshare:" "-vv"]
2024/06/07 16:51:43 DEBUG : Creating backend with remote "mysource:myshare"
2024/06/07 16:51:43 DEBUG : Using config file from "/config/rclone/rclone.conf"
2024/06/07 16:51:43 DEBUG : pacer: low level retry 1/10 (error couldn't connect SMB: invalid response error: expected session id: 0, got 6270136581206573312)
2024/06/07 16:51:43 DEBUG : pacer: Rate limited, increasing sleep to 200ms
2024/06/07 16:51:43 DEBUG : pacer: low level retry 2/10 (error couldn't connect SMB: invalid response error: expected session id: 0, got 6414251769282429184)
2024/06/07 16:51:43 DEBUG : pacer: Rate limited, increasing sleep to 400ms
2024/06/07 16:51:43 DEBUG : pacer: low level retry 3/10 (error couldn't connect SMB: invalid response error: expected session id: 0, got 6558366957358285056)
2024/06/07 16:51:43 DEBUG : pacer: Rate limited, increasing sleep to 800ms
2024/06/07 16:51:44 DEBUG : pacer: low level retry 4/10 (error couldn't connect SMB: invalid response error: expected session id: 0, got 6702482145434140928)
2024/06/07 16:51:44 DEBUG : pacer: Rate limited, increasing sleep to 1.6s
2024/06/07 16:51:45 DEBUG : pacer: low level retry 5/10 (error couldn't connect SMB: invalid response error: expected session id: 0, got 6846597333509996800)
2024/06/07 16:51:45 DEBUG : pacer: Rate limited, increasing sleep to 2s
2024/06/07 16:51:46 DEBUG : pacer: low level retry 6/10 (error couldn't connect SMB: invalid response error: expected session id: 0, got 6990712521585852672)
2024/06/07 16:51:48 DEBUG : pacer: low level retry 7/10 (error couldn't connect SMB: invalid response error: expected session id: 0, got 7134827709661708544)
2024/06/07 16:51:50 DEBUG : pacer: low level retry 8/10 (error couldn't connect SMB: invalid response error: expected session id: 0, got 7278942897737564416)
2024/06/07 16:51:52 DEBUG : pacer: low level retry 9/10 (error couldn't connect SMB: invalid response error: expected session id: 0, got 7423058085813420288)
2024/06/07 16:51:54 DEBUG : pacer: low level retry 10/10 (error couldn't connect SMB: invalid response error: expected session id: 0, got 7567173273889276160)
2024/06/07 16:51:54 ERROR : : error listing: couldn't connect SMB: invalid response error: expected session id: 0, got 7567173273889276160
2024/06/07 16:51:54 DEBUG : 25 go routines active
2024/06/07 16:51:54 Failed to ls with 2 errors: last error was: couldn't connect SMB: invalid response error: expected session id: 0, got 7567173273889276160

I use the same rclone config to move files from mysource to mydest, and also rclone move fails with the same error.
Connecting to mysource:myshare using another samba client works.

welcome to the forum,

can you tell us about the smb server?

i have a howto guide about rclone and smb/samba.
https://forum.rclone.org/t/how-to-access-smb-samba-with-rclone/42754

Hy,
the server is an IBM System i (AS400) ...
Thank you for your post: I'm using rclone in a docker container, mounting an smb share requires building the image with samba tools and scripting the share mount. Mounting the share in the host os is a no go. There will be a lot of shares to manage...

i am asking the the samba server, not the host server.

The samba server IS an IBM AS400 that shares files as a samba share.
I try to read file on the ISBM as400 via it's samba share and transfer to an SFTP server with rclone.

rclone relies on a third party library for smb, which has not been update in over two years.
so this might not a rclone issue.

can check the samba logs

It's not a linux samba server. It's an IBM AS400 service that expose a smb network share.
I've run some nmap scripts to diagnose it.
They say:

| smb2-capabilities: 
|   2:0:2: 
|     All capabilities are disabled
|   2:1:0: 
|     Multi-credit operations
|   3:0:0: 
|_    Multi-credit operations

| smb2-security-mode: 
|   3:0:0: 
|_    Message signing enabled but not required
| smb2-time: 
|   date: 2024-06-07T18:21:09
|_  start_date: 2024-06-07T03:06:47
|_smb-print-text: false
| smb-protocols: 
|   dialects: 
|     NT LM 0.12 (SMBv1) [dangerous, but default]
|     2:0:2
|     2:1:0
|_    3:0:0
| smb-security-mode: 
|   account_used: guest
|   authentication_level: user
|   challenge_response: supported
|_  message_signing: supported

If you want to know what packages are installed in the docker image, here they are (no samba related packages found):

/data # apk list
alpine-baselayout-3.4.3-r2 x86_64 {alpine-baselayout} (GPL-2.0-only) [installed]
alpine-baselayout-data-3.4.3-r2 x86_64 {alpine-baselayout} (GPL-2.0-only) [installed]
alpine-keys-2.4-r1 x86_64 {alpine-keys} (MIT) [installed]
apk-tools-2.14.0-r5 x86_64 {apk-tools} (GPL-2.0-only) [installed]
busybox-1.36.1-r15 x86_64 {busybox} (GPL-2.0-only) [installed]
busybox-binsh-1.36.1-r15 x86_64 {busybox} (GPL-2.0-only) [installed]
ca-certificates-20230506-r0 x86_64 {ca-certificates} (MPL-2.0 AND MIT) [installed]
ca-certificates-bundle-20230506-r0 x86_64 {ca-certificates} (MPL-2.0 AND MIT) [installed]
fuse-common-3.16.2-r0 x86_64 {fuse3} (GPL-2.0-only AND LGPL-2.1-only) [installed]
fuse3-3.16.2-r0 x86_64 {fuse3} (GPL-2.0-only AND LGPL-2.1-only) [installed]
fuse3-libs-3.16.2-r0 x86_64 {fuse3} (GPL-2.0-only AND LGPL-2.1-only) [installed]
libc-utils-0.7.2-r5 x86_64 {libc-dev} (BSD-2-Clause AND BSD-3-Clause) [installed]
libcrypto3-3.1.4-r5 x86_64 {openssl} (Apache-2.0) [installed]
libssl3-3.1.4-r5 x86_64 {openssl} (Apache-2.0) [installed]
musl-1.2.4_git20230717-r4 x86_64 {musl} (MIT) [installed]
musl-utils-1.2.4_git20230717-r4 x86_64 {musl} (MIT AND BSD-2-Clause AND GPL-2.0-or-later) [installed]
scanelf-1.3.7-r2 x86_64 {pax-utils} (GPL-2.0-only) [installed]
ssl_client-1.36.1-r15 x86_64 {busybox} (GPL-2.0-only) [installed]
tzdata-2024a-r0 x86_64 {tzdata} (Public-Domain) [installed]
zlib-1.3.1-r0 x86_64 {zlib} (Zlib) [installed]

In any case, you're right: the error is raised by the smb go library here: go-smb2/session.go at c8e61c7a5fa7bcd1143359f071f9425a9f4dda3f · hirochachacha/go-smb2 · GitHub