NewFs: couldn't initialise SFTP: EOF

What is the problem you are having with rclone?

I am able to SSH into my remote machine by

ssh 10.1.0.12 \
  -l root \
  -i ~/.ssh/id_ed25519 \
  -p 22

However, I am not be able to use Rclone, for example, to list files.

I did search online, but didn't find anything related. (Couldn't initialize SFTP: EOF does not help, as I am able to use SSH in my case.)

Any guide to resolve the error NewFs: couldn't initialise SFTP: EOF would be appreciate! Thanks! :smiley:

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

rclone v1.61.1
- os/version: ubuntu 20.04 (64 bit)
- os/kernel: 5.8.0-54-lowlatency (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.19.4
- go/linking: static
- go/tags: none

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

SFTP

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

rclone ls my-remote:/data/records

The rclone config contents with secrets removed.

[my-remote]
type = sftp
port = 22
key_file = /home/ubuntu/.ssh/id_ed25519
user = root
host = 10.1.0.12

A log from the command with the -vv flag

rclone ls my-remote:/data/records -vv
2023/01/06 21:25:19 DEBUG : rclone: Version "v1.61.1" starting with parameters ["rclone" "ls" "my-remote:/data/records" "-vv"]
2023/01/06 21:25:19 DEBUG : Creating backend with remote "my-remote:/data/records"
2023/01/06 21:25:19 DEBUG : Using config file from "/home/ubuntu/.config/rclone/rclone.conf"
2023/01/06 21:25:19 DEBUG : sftp://root@10.1.0.12:22//data/records: New connection 10.1.0.220:47488->10.1.0.12:22 to "SSH-2.0-OpenSSH_8.2"
2023/01/06 21:25:19 DEBUG : pacer: low level retry 1/10 (error couldn't initialise SFTP: EOF)
2023/01/06 21:25:19 DEBUG : pacer: Rate limited, increasing sleep to 200ms
2023/01/06 21:25:19 DEBUG : sftp://root@10.1.0.12:22//data/records: New connection 10.1.0.220:47490->10.1.0.12:22 to "SSH-2.0-OpenSSH_8.2"
2023/01/06 21:25:19 DEBUG : pacer: low level retry 2/10 (error couldn't initialise SFTP: EOF)
2023/01/06 21:25:19 DEBUG : pacer: Rate limited, increasing sleep to 400ms
2023/01/06 21:25:19 DEBUG : sftp://root@10.1.0.12:22//data/records: New connection 10.1.0.220:47492->10.1.0.12:22 to "SSH-2.0-OpenSSH_8.2"
2023/01/06 21:25:19 DEBUG : pacer: low level retry 3/10 (error couldn't initialise SFTP: EOF)
2023/01/06 21:25:19 DEBUG : pacer: Rate limited, increasing sleep to 800ms
2023/01/06 21:25:20 DEBUG : sftp://root@10.1.0.12:22//data/records: New connection 10.1.0.220:47494->10.1.0.12:22 to "SSH-2.0-OpenSSH_8.2"
2023/01/06 21:25:20 DEBUG : pacer: low level retry 4/10 (error couldn't initialise SFTP: EOF)
2023/01/06 21:25:20 DEBUG : pacer: Rate limited, increasing sleep to 1.6s
2023/01/06 21:25:20 DEBUG : sftp://root@10.1.0.12:22//data/records: New connection 10.1.0.220:47496->10.1.0.12:22 to "SSH-2.0-OpenSSH_8.2"
2023/01/06 21:25:20 DEBUG : pacer: low level retry 5/10 (error couldn't initialise SFTP: EOF)
2023/01/06 21:25:20 DEBUG : pacer: Rate limited, increasing sleep to 2s
2023/01/06 21:25:22 DEBUG : sftp://root@10.1.0.12:22//data/records: New connection 10.1.0.220:47498->10.1.0.12:22 to "SSH-2.0-OpenSSH_8.2"
2023/01/06 21:25:22 DEBUG : pacer: low level retry 6/10 (error couldn't initialise SFTP: EOF)
2023/01/06 21:25:24 DEBUG : sftp://root@10.1.0.12:22//data/records: New connection 10.1.0.220:47500->10.1.0.12:22 to "SSH-2.0-OpenSSH_8.2"
2023/01/06 21:25:24 DEBUG : pacer: low level retry 7/10 (error couldn't initialise SFTP: EOF)
2023/01/06 21:25:26 DEBUG : sftp://root@10.1.0.12:22//data/records: New connection 10.1.0.220:47502->10.1.0.12:22 to "SSH-2.0-OpenSSH_8.2"
2023/01/06 21:25:26 DEBUG : pacer: low level retry 8/10 (error couldn't initialise SFTP: EOF)
2023/01/06 21:25:28 DEBUG : sftp://root@10.1.0.12:22//data/records: New connection 10.1.0.220:47504->10.1.0.12:22 to "SSH-2.0-OpenSSH_8.2"
2023/01/06 21:25:28 DEBUG : pacer: low level retry 9/10 (error couldn't initialise SFTP: EOF)
2023/01/06 21:25:30 DEBUG : sftp://root@10.1.0.12:22//data/records: New connection 10.1.0.220:47506->10.1.0.12:22 to "SSH-2.0-OpenSSH_8.2"
2023/01/06 21:25:30 DEBUG : pacer: low level retry 10/10 (error couldn't initialise SFTP: EOF)
2023/01/06 21:25:30 Failed to create file system for "my-remote:/data/records": NewFs: couldn't initialise SFTP: EOF

EOF usually means the server just wouldn't talk to rclone and closed the connection straight away.

Could it be firewalled in some way?

Are you sure sftp is allowed on that server? Note that sftp is a seperate protocol within ssh and it can be disabled independently. You cold try the sftp binary and see if that works.

1 Like

Thanks for the info, Nick! I You are right! sftp shows same thing.

sftp \
>   -i ~/.ssh/id_ed25519 \
>   -P 22 \
>   root@10.1.0.12
Connection closed

I will do more research about setting up SFTP on the server and report back! :smiley:

1 Like

Just add a follow up. I found the remote system I am trying to use rclone is a customized Linux distribution created by Yocto Project. So SFTP component is missing.

ssh and rsync work, because rsync works over SSH protocol. rclone does not work because SFTP is a separate protocol.

If I want to use rclone, I guess I have to add SFTP component to that Linux distribution.

rsync runs the local rsync binary over ssh.

Indeed, but it works the same way and the binary is called /usr/lib/openssh/sftp-server

If you can get that binary on the remote system then you can make SFTP work.

You can run rclone serve sftp also as the binary - see the start of the sftp serve docs for how to set it up.

1 Like

Thank you for the info, Nick! :smiley:

1 Like

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