Rclone serve sftp not working in Windows

What is the problem you are having with rclone?

Not possible to use rclone serve sftp on Windows

What is your rclone version (output from rclone version)

rclone v1.49.5

  • os/arch: windows/amd64
  • go version: go1.12.10

Which OS you are using and how many bits (eg Windows 7, 64 bit)

Windows 10 Pro x64 bits 1903

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

Google Drive wrapped in cache remote

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

rclone serve sftp FLEXDriveCache: --user ferferga --pass test --addr 127.0.0.1:2020 --log-level=DEBUG --log-file=C:\Users\Fernando\Desktop\log.txt

A log from the command with the -vv flag (eg output from rclone -vv copy /tmp remote:tmp)

This is the log file outputted to the log.txt file, as stated in the command

2019/10/09 10:25:55 DEBUG : rclone: Version "v1.49.5" starting with parameters ["rclone" "serve" "sftp" "FLEXDriveCache:" "--user" "ferferga" "--pass" "test" "--addr" "127.0.0.1:2020" "--log-level=DEBUG" "--log-file=C:\Users\Fernando\Desktop\log.txt"]
2019/10/09 10:25:55 DEBUG : Using config file from "C:\Users\Fernando\.config\rclone\rclone.conf"
2019/10/09 10:25:55 DEBUG : FLEXDriveCache: wrapped FLEXDrive: at root
2019/10/09 10:25:55 DEBUG : FLEXDriveCache: Purging the DB
2019/10/09 10:25:55 INFO : FLEXDriveCache: Cache DB path: H:\Archivos de Programa\rclone\cache\FLEXDriveCache.db
2019/10/09 10:25:55 INFO : FLEXDriveCache: Cache chunk path: H:\Archivos de Programa\rclone\cache\FLEXDriveCache
2019/10/09 10:25:56 INFO : FLEXDriveCache: Chunk Memory: true
2019/10/09 10:25:56 INFO : FLEXDriveCache: Chunk Size: 10M
2019/10/09 10:25:56 INFO : FLEXDriveCache: Chunk Total Size: 10G
2019/10/09 10:25:56 INFO : FLEXDriveCache: Chunk Clean Interval: 1m0s
2019/10/09 10:25:56 INFO : FLEXDriveCache: Workers: 3
2019/10/09 10:25:56 INFO : FLEXDriveCache: File Age: 1d
2019/10/09 10:25:56 INFO : FLEXDriveCache: Cache Writes: enabled
2019/10/09 10:25:56 INFO : FLEXDriveCache: Upload Temp Rest Time: 2s
2019/10/09 10:25:56 INFO : FLEXDriveCache: Upload Temp FS: H:/Archivos de Programa/rclone/cache
2019/10/09 10:25:56 DEBUG : Adding path "cache/expire" to remote control registry
2019/10/09 10:25:56 DEBUG : Adding path "cache/stats" to remote control registry
2019/10/09 10:25:56 DEBUG : Adding path "cache/fetch" to remote control registry
2019/10/09 10:25:56 DEBUG : Cache remote FLEXDriveCache:: subscribing to ChangeNotify
2019/10/09 10:25:56 DEBUG : Adding path "vfs/forget" to remote control registry
2019/10/09 10:25:56 DEBUG : Adding path "vfs/refresh" to remote control registry
2019/10/09 10:25:56 DEBUG : Adding path "vfs/poll-interval" to remote control registry
2019/10/09 10:25:56 NOTICE: Loaded 0 authorized keys from "C:\Users\Fernando\.ssh\authorized_keys"
2019/10/09 10:25:56 DEBUG : Loaded private key from "C:\Users\Fernando\AppData\Local\rclone\serve-sftp\id_rsa"
2019/10/09 10:25:56 NOTICE: SFTP server listening on 127.0.0.1:2020
2019/10/09 10:26:56 DEBUG : Cache remote FLEXDriveCache:: starting cleanup
2019/10/09 10:26:56 INFO :
Transferred: 0 / 0 Bytes, -, 0 Bytes/s, ETA -
Errors: 0
Checks: 0 / 0, -
Transferred: 0 / 0, -
Elapsed time: 0s

2019/10/09 10:26:56 DEBUG : Google drive root '': Checking for changes on remote
2019/10/09 10:27:10 DEBUG : serve sftp 127.0.0.1:49985->127.0.0.1:2020: ssh auth "none" from "SSH-2.0-OpenSSH_7.5": ssh: no auth passed yet
2019/10/09 10:27:10 DEBUG : serve sftp 127.0.0.1:49985->127.0.0.1:2020: Password login attempt for ferferga
2019/10/09 10:27:10 DEBUG : serve sftp 127.0.0.1:49985->127.0.0.1:2020: ssh auth "password" from "SSH-2.0-OpenSSH_7.5": OK
2019/10/09 10:27:10 INFO : serve sftp 127.0.0.1:49985->127.0.0.1:2020: SSH login from ferferga using SSH-2.0-OpenSSH_7.5
2019/10/09 10:27:10 DEBUG : serve sftp 127.0.0.1:49985->127.0.0.1:2020: Incoming channel: session
2019/10/09 10:27:10 DEBUG : serve sftp 127.0.0.1:49985->127.0.0.1:2020: Channel accepted
2019/10/09 10:27:10 DEBUG : serve sftp 127.0.0.1:49985->127.0.0.1:2020: Request: subsystem
2019/10/09 10:27:10 DEBUG : serve sftp 127.0.0.1:49985->127.0.0.1:2020: Subsystem: sftp
2019/10/09 10:27:10 DEBUG : serve sftp 127.0.0.1:49985->127.0.0.1:2020: - accepted: true
2019/10/09 10:27:10 DEBUG : serve sftp 127.0.0.1:49985->127.0.0.1:2020: Starting SFTP server
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x18 pc=0x1095bf8]

goroutine 85 [running]:
github.com/rclone/rclone/vendor/github.com/pkg/sftp.filestat(0x18d7c60, 0xc0001fa180, 0xc0004dc180, 0x18e98a0, 0xc000026260, 0x18e8020, 0x40a913)
D:/a/rclone/src/github.com/rclone/rclone/vendor/github.com/pkg/sftp/request.go:317 +0xb8
github.com/rclone/rclone/vendor/github.com/pkg/sftp.(*Request).call(0xc0004dc180, 0x18d7c80, 0xc0001fa180, 0x18d7ca0, 0xc0001fa180, 0x18d7c40, 0xc0001fa180, 0x18d7c60, 0xc0001fa180, 0x18e98a0, ...)
D:/a/rclone/src/github.com/rclone/rclone/vendor/github.com/pkg/sftp/request.go:166 +0x309
github.com/rclone/rclone/vendor/github.com/pkg/sftp.(*RequestServer).packetWorker(0xc0000a2680, 0x18fc5e0, 0xc000551240, 0xc0002962a0, 0x0, 0x0)
D:/a/rclone/src/github.com/rclone/rclone/vendor/github.com/pkg/sftp/request-server.go:187 +0x560
github.com/rclone/rclone/vendor/github.com/pkg/sftp.(*RequestServer).Serve.func1.1(0xc0004070d0, 0xc0000a2680, 0x18fc5e0, 0xc000551240, 0xc0002962a0)
D:/a/rclone/src/github.com/rclone/rclone/vendor/github.com/pkg/sftp/request-server.go:98 +0x7a
created by github.com/rclone/rclone/vendor/github.com/pkg/sftp.(*RequestServer).Serve.func1
D:/a/rclone/src/github.com/rclone/rclone/vendor/github.com/pkg/sftp/request-server.go:96 +0xa8

Thanks for reporting this.

Can you tell me how you were accessing the sftp server? Which program were you using and what did you do with it?

This is crashing because rclone is receiving an sftp command it doesn't handle "Readlink".

I've changed the code so it returns an unsupported error for this rather than crashing. This will probably work now, but may produce errors in the calling application so more work may be needed - let me know what happens!

https://beta.rclone.org/branch/v1.49.5-189-gec259695-fix-serve-sftp-beta/ (uploaded in 15-30 mins)

As you might remember from the thread about mount in Windows, I'm trying to get rclone to be mounted as a network drive in Windows systems. In the meantime, as a workaround, I tried to use SSHFS-Win (https://github.com/billziss-gh/sshfs-win) to mount it. As long as credentials are entered, rclone crash.

Thanks for the info. Can you try the beta above and see if it fixes it?

rclone doesn't crash, but SSHFS-Win can't report the free/total space of the remote, when it does it perfectly for my Raspberry Pi.

Unfortunately the library rclone uses doesn't support the extended sftp call necessary to show free/total space: https://github.com/pkg/sftp/issues/236

Does it work otherwise?

I've merged the above fix to master now which means it will be in the latest beta in 15-30 mins and released in v1.50

I found a bug in the above fix so I suggest you try the latest beta in about 20 minutes from now!

Yes, perfectly at the moment,

Trying the latest beta as well

Thank you very much for this great piece of software and your support!

Great

Thank you

:blush:

1 Like