Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

sftp: expand tilde and environment variables in configured known_hosts_file (#5322)

albertonyce83228cb21e
diff --git a/backend/sftp/sftp.go b/backend/sftp/sftp.go
index e9f5a490a..ea003cda5 100644
--- a/backend/sftp/sftp.go
+++ b/backend/sftp/sftp.go
@@ -566,7 +566,7 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
}
if opt.KnownHostsFile != "" {
- hostcallback, err := knownhosts.New(opt.KnownHostsFile)
+ hostcallback, err := knownhosts.New(env.ShellExpand(opt.KnownHostsFile))
if err != nil {
return nil, errors.Wrap(err, "couldn't parse known_hosts_file")
}