mirror of
https://github.com/rclone/rclone.git
synced 2024-11-07 17:14:44 +01:00
sftp: Fix SSH key PEM loading
For SSH authentication, `key_pem` should both override `key_file` and not require other SSH authentication methods to be set. Prior to this fix, rclone would attempt to use an ssh-agent when `key_pem` was the only SSH authentication method set. Fixes #4240
This commit is contained in:
parent
fb06427c69
commit
f9306218f8
@ -395,8 +395,8 @@ func NewFs(name, root string, m configmap.Mapper) (fs.Fs, error) {
|
||||
|
||||
keyFile := env.ShellExpand(opt.KeyFile)
|
||||
//keyPem := env.ShellExpand(opt.KeyPem)
|
||||
// Add ssh agent-auth if no password or file specified
|
||||
if (opt.Pass == "" && keyFile == "" && !opt.AskPassword) || opt.KeyUseAgent {
|
||||
// Add ssh agent-auth if no password or file or key PEM specified
|
||||
if (opt.Pass == "" && keyFile == "" && !opt.AskPassword && opt.KeyPem == "") || opt.KeyUseAgent {
|
||||
sshAgentClient, _, err := sshagent.New()
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "couldn't connect to ssh-agent")
|
||||
|
Loading…
Reference in New Issue
Block a user