Can't connect rclone with existing ssh keys

What is the problem you are having with rclone?

First of all, thanks for the great software and support.

I can't get rclone -vv lsd remote_name: to work on a macOS host with Ubuntu storage system over a Tailscale connection.
I did eval `ssh-agent -s` && ssh-add -A before running the rclone command, but that didn't help.

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

rclone v1.69.3

  • os/version: darwin 15.5 (64 bit)
  • os/kernel: 24.5.0 (arm64)
  • os/type: darwin
  • os/arch: arm64 (ARMv8 compatible)
  • go/version: go1.24.3
  • go/linking: dynamic
  • go/tags: cmount

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

Remote ubuntu setup with:
rclone v1.69.3

  • os/version: ubuntu 24.04 (64 bit)
  • os/kernel: 6.11.0-26-generic (x86_64)
  • os/type: linux
  • os/arch: amd64
  • go/version: go1.24.3
  • go/linking: static
  • go/tags: none

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

eval `ssh-agent -s` && ssh-add -A
rclone -vv lsd remote_name:

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

rclone config:

[remote_name]
type = sftp
host = ssh_name
use_ssh_agent = true

.ssh/config:

Host ssh_name
    HostName X.X.X.X
    User XXX
    IdentityFile ~/.ssh/XXX

When I run ssh ssh_name, all works well.

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

2025/05/27 11:32:35 DEBUG : rclone: Version "v1.69.3" starting with parameters ["rclone" "-vv" "lsd" "remote_name:"]
2025/05/27 11:32:35 DEBUG : Creating backend with remote "remote_name:"
2025/05/27 11:32:35 DEBUG : Using config file from "/Users/user/.config/rclone/rclone.conf"
2025/05/27 11:32:35 DEBUG : pacer: low level retry 1/10 (error couldn't connect SSH: dial tcp: lookup ssh_name: no such host)
2025/05/27 11:32:35 DEBUG : pacer: Rate limited, increasing sleep to 200ms
2025/05/27 11:32:35 DEBUG : pacer: low level retry 2/10 (error couldn't connect SSH: dial tcp: lookup ssh_name: no such host)
2025/05/27 11:32:35 DEBUG : pacer: Rate limited, increasing sleep to 400ms
2025/05/27 11:32:36 DEBUG : pacer: low level retry 3/10 (error couldn't connect SSH: dial tcp: lookup ssh_name: no such host)
2025/05/27 11:32:36 DEBUG : pacer: Rate limited, increasing sleep to 800ms
2025/05/27 11:32:36 DEBUG : pacer: low level retry 4/10 (error couldn't connect SSH: dial tcp: lookup ssh_name: no such host)
2025/05/27 11:32:36 DEBUG : pacer: Rate limited, increasing sleep to 1.6s
2025/05/27 11:32:37 DEBUG : pacer: low level retry 5/10 (error couldn't connect SSH: dial tcp: lookup ssh_name: no such host)
2025/05/27 11:32:37 DEBUG : pacer: Rate limited, increasing sleep to 2s
2025/05/27 11:32:38 DEBUG : pacer: low level retry 6/10 (error couldn't connect SSH: dial tcp: lookup ssh_name: no such host)
2025/05/27 11:32:40 DEBUG : pacer: low level retry 7/10 (error couldn't connect SSH: dial tcp: lookup ssh_name: no such host)
2025/05/27 11:32:42 DEBUG : pacer: low level retry 8/10 (error couldn't connect SSH: dial tcp: lookup ssh_name: no such host)
2025/05/27 11:32:44 DEBUG : pacer: low level retry 9/10 (error couldn't connect SSH: dial tcp: lookup ssh_name: no such host)
2025/05/27 11:32:46 DEBUG : pacer: low level retry 10/10 (error couldn't connect SSH: dial tcp: lookup ssh_name: no such host)
2025/05/27 11:32:46 CRITICAL: Failed to create file system for "remote_name:": NewFs: couldn't connect SSH: dial tcp: lookup ssh_name: no such host

While typing, I found the solution here, but posted anyway because it might help someone else.

Instead, use the following rclone config file:

[remote_name]
type = sftp
host = X.X.X.X
user = XXX
key_file = ~/.ssh/XXX
known_hosts_file = ~/.ssh/known_hosts

I'm not sure if the known hosts part is necessary, I later removed it.

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