Couldn't initialise SFTP: error receiving version packet from server:

STOP and READ USE THIS TEMPLATE NO EXCEPTIONS - By not using this, you waste your time, our time and really hate puppies. Please remove these two lines and that will confirm you have read them.

What is the problem you are having with rclone?

sftp printerpi and ssh printerpi work thanks to ~/.ssh/config but I cannot use them in rclone. I tried to ls a remote I created but it seems to have problems once connected couldn't initialise SFTP: error receiving version packet from server:

What am I missing?

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

~/bin/rclone version
rclone v1.67.0

  • os/version: darwin 14.5 (64 bit)
  • os/kernel: 23.5.0 (x86_64)
  • os/type: darwin
  • os/arch: amd64
  • go/version: go1.22.4
  • go/linking: dynamic
  • go/tags: cmount

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

SSH/SFTP

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

>~/bin/rclone --sftp-ssh "/usr/bin/ssh -F /Users/myuser/.ssh/config" ls printerpi:

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

[printerpi]
type = sftp
host = XXX
user = XXX
key_use_agent = true
ssh = /bin/bash -F /Users/myuser/.ssh/config
shell_type = unix
### Double check the config for sensitive info before posting publicly

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

2024/09/02 23:30:00 DEBUG : rclone: Version "v1.67.0" starting with parameters ["/Users/myuser/bin/rclone" "-vv" "--sftp-ssh" "/usr/bin/ssh -F /Users/myuser/.ssh/config" "ls" "printerpi:"]
2024/09/02 23:30:00 DEBUG : Creating backend with remote "printerpi:"
2024/09/02 23:30:00 DEBUG : Using config file from "/Users/myuser/.config/rclone/rclone.conf"
2024/09/02 23:30:00 DEBUG : printerpi: detected overridden config - adding "{Il9mw}" suffix to name
2024/09/02 23:30:00 NOTICE: printerpi{Il9mw}: --sftp-ssh is in use - ignoring user/host/port from config - set in the parameters to --sftp-ssh (remove them from the config to silence this warning)
2024/09/02 23:30:00 DEBUG : sftp://pi@printerpi:22/: ssh external: creating additional session
2024/09/02 23:30:00 DEBUG : sftp://pi@printerpi:22/: ssh external: running: /usr/bin/ssh -F /Users/myuser/.ssh/config -s sftp
2024/09/02 23:30:00 DEBUG : pacer: low level retry 1/10 (error couldn't initialise SFTP: error receiving version packet from server: server unexpectedly closed connection: unexpected EOF)
2024/09/02 23:30:00 DEBUG : pacer: Rate limited, increasing sleep to 200ms
2024/09/02 23:30:00 DEBUG : sftp://pi@printerpi:22/: ssh external: creating additional session
2024/09/02 23:30:00 DEBUG : sftp://pi@printerpi:22/: ssh external: running: /usr/bin/ssh -F /Users/myuser/.ssh/config -s sftp
2024/09/02 23:30:00 DEBUG : pacer: low level retry 2/10 (error couldn't initialise SFTP: error receiving version packet from server: server unexpectedly closed connection: unexpected EOF)
2024/09/02 23:30:00 DEBUG : pacer: Rate limited, increasing sleep to 400ms
2024/09/02 23:30:00 DEBUG : sftp://pi@printerpi:22/: ssh external: creating additional session
2024/09/02 23:30:00 DEBUG : sftp://pi@printerpi:22/: ssh external: running: /usr/bin/ssh -F /Users/myuser/.ssh/config -s sftp
2024/09/02 23:30:00 DEBUG : pacer: low level retry 3/10 (error couldn't initialise SFTP: error receiving version packet from server: server unexpectedly closed connection: unexpected EOF)
2024/09/02 23:30:00 DEBUG : pacer: Rate limited, increasing sleep to 800ms
2024/09/02 23:30:00 DEBUG : sftp://pi@printerpi:22/: ssh external: creating additional session
2024/09/02 23:30:00 DEBUG : sftp://pi@printerpi:22/: ssh external: running: /usr/bin/ssh -F /Users/myuser/.ssh/config -s sftp
2024/09/02 23:30:00 DEBUG : pacer: low level retry 4/10 (error couldn't initialise SFTP: error receiving version packet from server: server unexpectedly closed connection: unexpected EOF)
2024/09/02 23:30:00 DEBUG : pacer: Rate limited, increasing sleep to 1.6s
2024/09/02 23:30:01 DEBUG : sftp://pi@printerpi:22/: ssh external: creating additional session
2024/09/02 23:30:01 DEBUG : sftp://pi@printerpi:22/: ssh external: running: /usr/bin/ssh -F /Users/myuser/.ssh/config -s sftp
2024/09/02 23:30:01 DEBUG : pacer: low level retry 5/10 (error couldn't initialise SFTP: error receiving version packet from server: server unexpectedly closed connection: unexpected EOF)
2024/09/02 23:30:01 DEBUG : pacer: Rate limited, increasing sleep to 2s
2024/09/02 23:30:03 DEBUG : sftp://pi@printerpi:22/: ssh external: creating additional session
2024/09/02 23:30:03 DEBUG : sftp://pi@printerpi:22/: ssh external: running: /usr/bin/ssh -F /Users/myuser/.ssh/config -s sftp
2024/09/02 23:30:03 DEBUG : pacer: low level retry 6/10 (error couldn't initialise SFTP: error receiving version packet from server: server unexpectedly closed connection: unexpected EOF)
2024/09/02 23:30:05 DEBUG : sftp://pi@printerpi:22/: ssh external: creating additional session
2024/09/02 23:30:05 DEBUG : sftp://pi@printerpi:22/: ssh external: running: /usr/bin/ssh -F /Users/myuser/.ssh/config -s sftp
2024/09/02 23:30:05 DEBUG : pacer: low level retry 7/10 (error couldn't initialise SFTP: error receiving version packet from server: server unexpectedly closed connection: unexpected EOF)
2024/09/02 23:30:07 DEBUG : sftp://pi@printerpi:22/: ssh external: creating additional session
2024/09/02 23:30:07 DEBUG : sftp://pi@printerpi:22/: ssh external: running: /usr/bin/ssh -F /Users/myuser/.ssh/config -s sftp
2024/09/02 23:30:07 DEBUG : pacer: low level retry 8/10 (error couldn't initialise SFTP: error receiving version packet from server: server unexpectedly closed connection: unexpected EOF)
2024/09/02 23:30:09 DEBUG : sftp://pi@printerpi:22/: ssh external: creating additional session
2024/09/02 23:30:09 DEBUG : sftp://pi@printerpi:22/: ssh external: running: /usr/bin/ssh -F /Users/myuser/.ssh/config -s sftp
2024/09/02 23:30:09 DEBUG : pacer: low level retry 9/10 (error couldn't initialise SFTP: error receiving version packet from server: server unexpectedly closed connection: unexpected EOF)
2024/09/02 23:30:11 DEBUG : sftp://pi@printerpi:22/: ssh external: creating additional session
2024/09/02 23:30:11 DEBUG : sftp://pi@printerpi:22/: ssh external: running: /usr/bin/ssh -F /Users/myuser/.ssh/config -s sftp
2024/09/02 23:30:11 DEBUG : pacer: low level retry 10/10 (error couldn't initialise SFTP: error receiving version packet from server: server unexpectedly closed connection: unexpected EOF)
2024/09/02 23:30:11 Failed to create file system for "printerpi:": NewFs: couldn't initialise SFTP: error receiving version packet from server: server unexpectedly closed connection: unexpected EOF
1 Like

try:

[printerpi]
type = sftp
host = XXX
user = XXX
port = 22
shell_type = unix

and then:

$ rclone ls printerpi:

make sure that your ssh agent is loaded - see docs. I run:

ssh-add --apple-load-keychain

in every session (add this command to your shell profile script)

adding port=22 did not change the result.
My keys are added to the keychain, as they are in my bashrc file . Indeed I can log on without password on that machine using the hostname printerpi defined in the ~/.ssh/config file.

1 Like

Have you removed key_use_agent and ssh from your config?

Thanks for chiming in.

It works with

[rclone_printerpi]
type = sftp
host = printerpi
user = pi
port = 22
shell_type = unix

but also if I put the IP address in place of host = printerpi.

Why it works without using the ssh commands is very unclear to me, given all the long explanations of how ssh in rclone is reimplemented in go with a memory safe code.

In addition I have noted that for a remote that is not on my local network, which has been defined as well in ~/.ssh/config/ this trick does not work. So for now I can consider this solved, but limited to host = IP or hostname in my local network