Sftp serve password input holding connection hostage

The problem I am having with rclone, is when we serve sftp using an auth proxy. We allow users to input a username and password in some instances. When a user does this and the terminal prompts for a password, this hangs the process so if any other user attempts to connect to the server are held up by the initial request for the user to input the password field.
I have tried this locally and on a remote server and having another person lock the password stdin and it holding the process until they either enter a password or cancel.

What is your rclone version (output from rclone version)

rclone v1.52.2

  • os/arch: darwin/amd64
  • go version: go1.14.4

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

OSX 11.1 (20C69) locally and Scratch Docker container host for the server.

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

Google Cloud Storage

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

rclone serve sftp --addr 0.0.0.0:2022 --vfs-cache-mode off --auth-proxy `pwd`/auth --key `pwd`/tmp/keys/id_rsa -vv

The rclone config contents with secrets removed.

Using default config

A log from the command with the -vv flag

2020/12/18 15:21:10 DEBUG : Loaded private key from "/Users/someguy/Projects/x-sftp/tmp/keys/id_rsa"
2020/12/18 15:21:10 NOTICE: SFTP server listening on [::]:2022
2020/12/18 15:21:13 DEBUG : serve sftp [::1]:60337->[::1]:2022: ssh auth "none" from "SSH-2.0-OpenSSH_8.1": ssh: no auth passed yet
2020/12/18 15:21:13 DEBUG : serve sftp [::1]:60337->[::1]:2022: Public key login attempt for sftp_auth_test
2020/12/18 15:21:13 DEBUG : Calling proxy [/Users/someguy/Projects/x-sftp/auth]
2020/12/18 15:21:13 DEBUG : serve sftp [::1]:60337->[::1]:2022: ssh auth "publickey" from "SSH-2.0-OpenSSH_8.1": proxy: failed to read output: "": unexpected end of JSON input
2020/12/18 15:21:13 DEBUG : serve sftp [::1]:60337->[::1]:2022: Password login attempt for sftp_auth_test
2020/12/18 15:21:14 DEBUG : Calling proxy [/Users/someguy/Projects/x-sftp/auth]
2020/12/18 15:21:14 DEBUG : serve sftp [::1]:60337->[::1]:2022: ssh auth "password" from "SSH-2.0-OpenSSH_8.1": proxy: failed on [/Users/someguy/Projects/x-sftp/auth]: "Authentication failed": exit status 255

I managed to replicate this without the auth-proxy

This in one window

rclone serve -vv sftp --user x --pass x /tmp/mount/

And this in another

$ rclone lsf --sftp-ask-password --sftp-port 2022 --sftp-user x :sftp:
Enter SFTP password: 

Blocks this in a third window

$ rclone lsf --sftp-ask-password --sftp-port 2022 --sftp-user x :sftp:

I think this is a property of the serve ssh somehow

Can you please make a new issue on github with a link to this forum page and we'll have a go at fixing it - thanks!