From 395f25997880eb53ded2c78f56c709354f95a4c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Gross?= Date: Thu, 7 May 2020 12:02:52 +0200 Subject: [PATCH] cmd: when running --password-command allow use of stdin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bind rclone standard input to password command's standard input. This allows to provide password from a pipe and collect it using cat. The typical use case is when rclone is on a remote server with an encrypted configuration. This solved the environment variable issue (#3368) and the password storage on remote host. Now the following chain is allowed: echo 'secret' | ssh host.example.com \ sudo -u rclone \ rclone --config /path/to/rclone.conf \ --password-command 'cat' ls remote: Signed-off-by: Sébastien Gross Co-authored-by: Sébastien Gross --- fs/config/config.go | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/config/config.go b/fs/config/config.go index 53d67ef03..fcc42b097 100644 --- a/fs/config/config.go +++ b/fs/config/config.go @@ -282,6 +282,7 @@ func loadConfigFile() (*goconfig.ConfigFile, error) { cmd.Stdout = &stdout cmd.Stderr = &stderr + cmd.Stdin = os.Stdin if err := cmd.Run(); err != nil { // One does not always get the stderr returned in the wrapped error.