Sftp - ssh: no key found

What is the problem you are having with rclone?

I need to copy files to an SFTP target, where the target host is accepting only connection via key file.

Actually, I am able to scp from source to target using keyfile. So I'm sure that target host already has my pub key in the authorized_keys file.

I am not able to understand how to configure rclone to use my key file. I entered the path but rclone tells me it's not unable to found the ssh key

My source host key is at the path: /home/realtebo/.ssh/id_rsa

It is in the PEM format , I think, as required.

$ cat ~/.ssh/id_rsa
-----BEGIN RSA PRIVATE KEY-----
MIIEpQIBAAKCAQEAtBDnCMPAqJH9/+tcWkYvcJDSkdq12QHMwz7mPKL4Vp0KPyGa
... cut .... 
oOcZhByX31wc5YznoQ6VP0g+FP37XJb5IZ89ief0yKzIK1rlx7AM77I=
-----END RSA PRIVATE KEY-----

This is listing of /home/realtebo/.ssh

drwxrwxr-x 2 realtebo realtebo 4096 Jun 13 17:22 .
drwxr-xr-x 9 realtebo realtebo 4096 Jun 16  2022 ..
-rw-rw-r-- 1 realtebo realtebo  755 Aug 12  2022 authorized_keys
-rw------- 1 realtebo realtebo 1679 Aug 12  2022 id_rsa
-rw-r--r-- 1 realtebo realtebo  399 Aug 12  2022 id_rsa.pub

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

rclone v1.56.0
- os/version: ubuntu 14.04 (64 bit)
- os/kernel: 5.19.2-x86_64-linode156 (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.16.5
- 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 TransitoSuServer17: -vvvvvvvvvv

The rclone config contents with secrets removed.

[TransitoSuServer17]
type = sftp
host = 172.105.xx.yy
user = realtebo
port = 22
pass = 
md5sum_command = md5sum
sha1sum_command = sha1sum
key_pem = n
key_file = /home/realtebo/.ssh/id_rsa

A log from the command with the -vv flag

2023/06/30 12:16:21 DEBUG : rclone: Version "v1.56.0" starting with parameters ["rclone" "ls" "TransitoSuServer17:" "-vvvvvvvvvv"]
2023/06/30 12:16:21 DEBUG : Creating backend with remote "TransitoSuServer17:"
2023/06/30 12:16:21 DEBUG : Using config file from "/home/realtebo/.config/rclone/rclone.conf"
2023/06/30 12:16:21 Failed to create file system for "TransitoSuServer17:": failed to parse private key file: ssh: no key found

As per documentation:

-sftp-key-pem

Raw PEM-encoded private key.

If specified, will override key_file parameter.

Properties:

    Config: key_pem
    Env Var: RCLONE_SFTP_KEY_PEM
    Type: string
    Required: false

so your key_file is ignored.

Change your config to:

[TransitoSuServer17]
type = sftp
host = 172.105.xx.yy
user = realtebo
port = 22
md5sum_command = md5sum
sha1sum_command = sha1sum
key_file = /home/realtebo/.ssh/id_rsa

You either provide key inline using key_pem or in file using key_file

You are using very old rclone version - probably from Ubuntu repo which is outdated

You should be using the latest version.

run:

sudo apt remove rclone
sudo -v ; curl https://rclone.org/install.sh | sudo bash

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