From de147b6e545b6238d1de131df118f7c7da9003db Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Fri, 18 Aug 2023 11:45:31 +0100 Subject: [PATCH] sftp: fix --sftp-ssh looking for ssh agent - fixes #7235 Before this change if pass was empty this would attempt to connect to the ssh agent even when using --sftp-ssh. This patch prevents that. --- backend/sftp/sftp.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/sftp/sftp.go b/backend/sftp/sftp.go index 8c66fbb7e..b402ca713 100644 --- a/backend/sftp/sftp.go +++ b/backend/sftp/sftp.go @@ -836,7 +836,7 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e pubkeyFile := env.ShellExpand(opt.PubKeyFile) //keyPem := env.ShellExpand(opt.KeyPem) // Add ssh agent-auth if no password or file or key PEM specified - if (opt.Pass == "" && keyFile == "" && !opt.AskPassword && opt.KeyPem == "") || opt.KeyUseAgent { + if (len(opt.SSH) == 0 && opt.Pass == "" && keyFile == "" && !opt.AskPassword && opt.KeyPem == "") || opt.KeyUseAgent { sshAgentClient, _, err := sshagent.New() if err != nil { return nil, fmt.Errorf("couldn't connect to ssh-agent: %w", err)