Rclone will not accept it own ssh key for serve sftp

What is the problem you are having with rclone?

trying to generate a ssh private to use with rclone serve sftp.
i have tried many ways to create a key that --authorized-keys will accept.

as a test, i let rclone generate its own key.
when i set --authorized-keys to that exact same file. rclone complains
Failed to sftp: failed to parse authorized keys: ssh: no key found
note: the id_rsa file created by rclone used the EOL encoding of unix, not windows

Thanks

What is your rclone version (output from rclone version)

rclone v1.53.2 - os/arch: windows/amd64 - go version: go1.15.2

Which OS you are using and how many bits (eg Windows 7, 64 bit)

win10.2004.64bit

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

local sftp server via rclone serve sftp

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

rclone.exe serve sftp C:\data\rclone\scripts\rr\other\sftp\test -vv --authorized-keys=C:\Users\user01\AppData\Local\rclone\serve-sftp\id_rsa

The rclone config contents with secrets removed.

[localsftp]
type = sftp
host = localhost
port = 2222

A log from the command with the -vv flag

DEBUG : rclone: Version "v1.53.2" starting with parameters ["c:\\data\\rclone\\scripts\\rclone.exe" "serve" "sftp" "C:\\data\\rclone\\scripts\\rr\\other\\sftp\\test" "-vv" "--authorized-keys=C:\\Users\\user01\\AppData\\Local\\rclone\\serve-sftp\\id_rsa"]
2020/11/05 14:00:59 Failed to sftp: failed to parse authorized keys: ssh: no key found

and this is the key file created by rclone


-----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQEA0o8Id58FamSvpwfNvpAE5UkQcvTE8BfulaxBs30fcvci0jHW
s1GfDQySGQfWoqGbslEtXom1xOPqmPwP9V0f219BELvNSpFK0O+VKMvallx4sowI
98BtVj95a726n7E6PLc0j5MO14Q3GHOmxLqrN9p/sBCfUEftrFYQryU1nOB3AeEx
Nyxq+5D/QiCY/irO/IHJ4lPPeqTqNB/pvd4wXbXW9rsF7XSwri1mfHuamU8hqLvf
dT1J0PrSrIWTS86F/hEGMjeaeNYYJbRFBPp72HZjZqZ6ZGN0Un3d4F2YFGChMvqk
7KIHp/Fl06A1jBcvEXl78Fv7m9SEbQCr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9NxJ013ZMfo4gwg310NK/TbiwZLL36q11wQo/OV1BUD2CxPbagt
8Vf876BGlcfEob8/MQoKA5MKqNforWkZ+DtjouDqK39O+a4yoXq5LNq3SGi0dY7h
1MyaBB+HQFVu8iewVwRrwtbF/ROxcdzf1XE1IZ8W0SNqrLJ7T3Y=
-----END RSA PRIVATE KEY-----

You need to put the public part of the key into the file pointed to by --authorized-keys. These are typically one line and you can have lots of them in the file.

You are putting the private part of the key. The public part will be called id_rsa.pub or similar and look like this

ssh-rsa AAAAB3NzaC1...RAqcw== Nick Craig-Wood
1 Like

thanks, working now.

i keep getting confused with ssh

1 Like

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