Unable to authenticate using serve sftp --auth-proxy

What is the problem you are having with rclone?

serve sftp with auth-proxy hangs when authenticating

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

# rclone version
rclone v1.59.2
- os/version: ubuntu 20.04 (64 bit)
- os/kernel: 5.15.0-48-generic (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.18.6
- go/linking: static
- go/tags: none

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

local

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

$ cat auth.sh
#!/bin/bash
echo '{"type": "sftp", "_root": "local", "_obscure": "pass", "user": "me", "pass": "me", "host": "localhost", "port": "2022"}'

$ rclone -vv --auth-proxy ./auth.sh serve sftp
2022/10/04 14:25:02 DEBUG : rclone: Version "v1.59.2" starting with parameters ["rclone" "-vv" "--auth-proxy" "./auth.sh" "serve" "sftp"]
2022/10/04 14:25:02 DEBUG : Loaded private key from "/root/.cache/rclone/serve-sftp/id_rsa"
2022/10/04 14:25:02 DEBUG : Loaded private key from "/root/.cache/rclone/serve-sftp/id_ecdsa"
2022/10/04 14:25:02 DEBUG : Loaded private key from "/root/.cache/rclone/serve-sftp/id_ed25519"
2022/10/04 14:25:02 NOTICE: SFTP server listening on 127.0.0.1:2022

Then in another shell

$ sftp -P 2022 me@localhost
# sftp -P 2022 me@localhost
The authenticity of host '[localhost]:2022 ([127.0.0.1]:2022)' can't be established.
ECDSA key fingerprint is SHA256:cxwjSvOfYKFvglyRfVtbTYMktoGnR5FIgPIWUoB1S7c.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '[localhost]:2022' (ECDSA) to the list of known hosts.
me@localhost's password:             <-- me

This hangs

In the first terminal, the following is shown. The last four lines keep repeating

2022/10/04 14:26:37 INFO  : 
Transferred:   	          0 B / 0 B, -, 0 B/s, ETA -
Elapsed time:       1m0.0s

2022/10/04 14:27:36 DEBUG : serve sftp 127.0.0.1:44588->127.0.0.1:2022: ssh auth "none" from "SSH-2.0-OpenSSH_8.2p1 Ubuntu-4ubuntu0.5": ssh: no auth passed yet
2022/10/04 14:27:37 INFO  : 
Transferred:   	          0 B / 0 B, -, 0 B/s, ETA -
Elapsed time:       2m0.0s

2022/10/04 14:27:50 DEBUG : serve sftp 127.0.0.1:44588->127.0.0.1:2022: Password login attempt for me
2022/10/04 14:27:50 DEBUG : Calling proxy [./auth.sh]
2022/10/04 14:27:50 DEBUG : Proxy returned in 3.189948ms
2022/10/04 14:27:50 DEBUG : serve sftp 127.0.0.1:34914->127.0.0.1:2022: ssh auth "none" from "SSH-2.0-rclone/v1.59.2": ssh: no auth passed yet
2022/10/04 14:27:50 DEBUG : serve sftp 127.0.0.1:34914->127.0.0.1:2022: Password login attempt for me
2022/10/04 14:27:50 DEBUG : Calling proxy [./auth.sh]
2022/10/04 14:27:50 DEBUG : Proxy returned in 1.41079ms
2022/10/04 14:27:50 DEBUG : serve sftp 127.0.0.1:34920->127.0.0.1:2022: ssh auth "none" from "SSH-2.0-rclone/v1.59.2": ssh: no auth passed yet
2022/10/04 14:27:50 DEBUG : serve sftp 127.0.0.1:34920->127.0.0.1:2022: Password login attempt for me
2022/10/04 14:27:50 DEBUG : Calling proxy [./auth.sh]
2022/10/04 14:27:50 DEBUG : Proxy returned in 1.114584ms
2022/10/04 14:27:50 DEBUG : serve sftp 127.0.0.1:34932->127.0.0.1:2022: ssh auth "none" from "SSH-2.0-rclone/v1.59.2": ssh: no auth passed yet
2022/10/04 14:27:50 DEBUG : serve sftp 127.0.0.1:34932->127.0.0.1:2022: Password login attempt for me

The rclone config contents with secrets removed.

no config

A log from the command with the -vv flag

see above

This is because your auth proxy scripts points to the rclone sftp server so creates a loop.

As in this remote points to the rclone serve sftp command you ran. You might change the host or port.

{
"type": "sftp",
"_root": "local",
"_obscure": "pass",
"user": "me",
"pass": "me",
"host": "localhost",
"port": "2022"
}

Try this really simple auth proxy script to see how it should work.

#!/bin/bash

echo '{"type": "local", "_root": "/tmp"}'

Now I get what auth-proxy is doing. Thanks!

FWIW, compliments on some very well written code. RCLONE is a pleasure to use.

1 Like

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