diff --git a/pkg/object/sftp.go b/pkg/object/sftp.go index 4ad254188395..d99fcb12606e 100644 --- a/pkg/object/sftp.go +++ b/pkg/object/sftp.go @@ -452,10 +452,7 @@ func newSftp(endpoint, username, pass, token string) (ObjectStorage, error) { username = unescape(username) var auth []ssh.AuthMethod if pass != "" { - pass = unescape(pass) - auth = append(auth, ssh.Password(pass)) - } else { - auth = append(auth, ssh.KeyboardInteractive(sshInteractive)) + auth = append(auth, ssh.Password(unescape(pass))) } var signers []ssh.Signer @@ -506,6 +503,10 @@ func newSftp(endpoint, username, pass, token string) (ObjectStorage, error) { auth = append(auth, ssh.PublicKeys(signers...)) } + if pass == "" { + auth = append(auth, ssh.KeyboardInteractive(sshInteractive)) + } + config := &ssh.ClientConfig{ User: username, HostKeyCallback: ssh.InsecureIgnoreHostKey(),