# Rclone serve sftp not working in Windows

**URL:** <https://forum.rclone.org/t/rclone-serve-sftp-not-working-in-windows/12209>\
**Category:** Suspected Bug\
**Created:** [October 9, 2019, 8:32am UTC](https://forum.rclone.org/t/rclone-serve-sftp-not-working-in-windows/12209 "2019-10-09T08:32:37Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![ferferga](https://forum.rclone.org/letter_avatar_proxy/v4/letter/f/dbc845/32.png) [@ferferga](https://forum.rclone.org/u/ferferga)\
**Post date:** [October 9, 2019, 8:32am UTC](https://forum.rclone.org/t/rclone-serve-sftp-not-working-in-windows/12209/1 "2019-10-09T08:32:37Z")

</div>

#### 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](http://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](http://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](http://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](http://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](http://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

---

<div class="post-metadata">

**Author:** ![ncw](https://forum.rclone.org/user_avatar/forum.rclone.org/ncw/32/18_2.png) [@ncw](https://forum.rclone.org/u/ncw)\
**Post date:** [October 9, 2019, 9:02am UTC](https://forum.rclone.org/t/rclone-serve-sftp-not-working-in-windows/12209/2 "2019-10-09T09:02:45Z")

</div>

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/](https://beta.rclone.org/branch/v1.49.5-189-gec259695-fix-serve-sftp-beta/) (uploaded in 15-30 mins)

---

<div class="post-metadata">

**Author:** ![ferferga](https://forum.rclone.org/letter_avatar_proxy/v4/letter/f/dbc845/32.png) [@ferferga](https://forum.rclone.org/u/ferferga)\
**Post date:** [October 9, 2019, 9:49am UTC](https://forum.rclone.org/t/rclone-serve-sftp-not-working-in-windows/12209/3 "2019-10-09T09:49:58Z")

</div>

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](https://github.com/billziss-gh/sshfs-win)) to mount it. As long as credentials are entered, rclone crash.

---

<div class="post-metadata">

**Author:** ![ncw](https://forum.rclone.org/user_avatar/forum.rclone.org/ncw/32/18_2.png) [@ncw](https://forum.rclone.org/u/ncw)\
**Post date:** [October 9, 2019, 11:10am UTC](https://forum.rclone.org/t/rclone-serve-sftp-not-working-in-windows/12209/4 "2019-10-09T11:10:32Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ferferga](https://forum.rclone.org/letter_avatar_proxy/v4/letter/f/dbc845/32.png) [@ferferga](https://forum.rclone.org/u/ferferga)\
**Post date:** [October 9, 2019, 11:49am UTC](https://forum.rclone.org/t/rclone-serve-sftp-not-working-in-windows/12209/5 "2019-10-09T11:49:16Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ncw](https://forum.rclone.org/user_avatar/forum.rclone.org/ncw/32/18_2.png) [@ncw](https://forum.rclone.org/u/ncw)\
**Post date:** [October 9, 2019, 3:13pm UTC](https://forum.rclone.org/t/rclone-serve-sftp-not-working-in-windows/12209/6 "2019-10-09T15:13:02Z")

</div>

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](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](https://beta.rclone.org) in 15-30 mins and released in v1.50

---

<div class="post-metadata">

**Author:** ![ncw](https://forum.rclone.org/user_avatar/forum.rclone.org/ncw/32/18_2.png) [@ncw](https://forum.rclone.org/u/ncw)\
**Post date:** [October 9, 2019, 4:59pm UTC](https://forum.rclone.org/t/rclone-serve-sftp-not-working-in-windows/12209/7 "2019-10-09T16:59:58Z")

</div>

I found a bug in the above fix so I suggest you try [the latest beta](https://beta.rclone.org) in about 20 minutes from now!

---

<div class="post-metadata">

**Author:** ![ferferga](https://forum.rclone.org/letter_avatar_proxy/v4/letter/f/dbc845/32.png) [@ferferga](https://forum.rclone.org/u/ferferga)\
**Post date:** [October 10, 2019, 6:33am UTC](https://forum.rclone.org/t/rclone-serve-sftp-not-working-in-windows/12209/8 "2019-10-10T06:33:07Z")

</div>

Yes, perfectly at the moment,

Trying the latest beta as well

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

---

<div class="post-metadata">

**Author:** ![ncw](https://forum.rclone.org/user_avatar/forum.rclone.org/ncw/32/18_2.png) [@ncw](https://forum.rclone.org/u/ncw)\
**Post date:** [October 10, 2019, 7:21am UTC](https://forum.rclone.org/t/rclone-serve-sftp-not-working-in-windows/12209/9 "2019-10-10T07:21:49Z")

</div>

> [@ferferga](#):
>
> Yes, perfectly at the moment,

Great

> [@ferferga](#):
>
> Trying the latest beta as well

Thank you

> [@ferferga](#):
>
> Thank you very much for this great piece of software and your support!

😊

---

<div class="post-metadata">

**Author:** ![system](https://forum.rclone.org/uploads/default/original/2X/3/39ad3235f6ffec76ccd0c81616bd55697b4c300d.png) [@system](https://forum.rclone.org/u/system)\
**Post date:** [January 8, 2020, 7:21am UTC](https://forum.rclone.org/t/rclone-serve-sftp-not-working-in-windows/12209/10 "2020-01-08T07:21:50Z")

</div>

Closed on January 8, 2020, 7:21am UTC

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
