"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
ftp: add --ftp-ask-password to prompt for password when needed
Borna Butkovic627ac1b2d927
diff --git a/backend/ftp/ftp.go b/backend/ftp/ftp.goindex 11ae2764d..15cbb5260 100644--- a/backend/ftp/ftp.go+++ b/backend/ftp/ftp.go@@ -61,7 +61,6 @@ func init() {Name: "pass",Help: "FTP password.",IsPassword: true,- Required: true,}, {Name: "tls",Help: `Use Implicit FTPS (FTP over TLS).@@ -139,6 +138,14 @@ Enabled by default. Use 0 to disable.`,Help: "Maximum time to wait for data connection closing status.",Default: fs.Duration(60 * time.Second),Advanced: true,+ }, {+ Name: "ask_password",+ Default: false,+ Help: `Allow asking for FTP password when needed.++If this is set and no password is supplied then rclone will ask for a password+`,+ Advanced: true,}, {Name: config.ConfigEncoding,Help: config.ConfigEncodingHelp,@@ -179,6 +186,7 @@ type Options struct {IdleTimeout fs.Duration `config:"idle_timeout"`CloseTimeout fs.Duration `config:"close_timeout"`ShutTimeout fs.Duration `config:"shut_timeout"`+ AskPassword bool `config:"ask_password"`Enc encoder.MultiEncoder `config:"encoding"`}@@ -444,9 +452,14 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (ff fs.Fsif err != nil {return nil, err}- pass, err := obscure.Reveal(opt.Pass)- if err != nil {- return nil, fmt.Errorf("NewFS decrypt password: %w", err)+ pass := ""+ if opt.AskPassword && opt.Pass == "" {+ pass = config.GetPassword("FTP server password")+ } else {+ pass, err = obscure.Reveal(opt.Pass)+ if err != nil {+ return nil, fmt.Errorf("NewFS decrypt password: %w", err)+ }}user := opt.Userif user == "" {diff --git a/docs/content/ftp.md b/docs/content/ftp.mdindex 587ff0fc3..85a696aab 100644--- a/docs/content/ftp.md+++ b/docs/content/ftp.md@@ -180,6 +180,15 @@ FTP password.- Type: string- Default: ""+#### --ftp-ask-password++Ask for password when connecting to a FTP server and no password is configured.++- Config: ask_password+- Env Var: RCLONE_FTP_ASK_PASSWORD+- Type: bool+- Default: false+#### --ftp-tlsUse Implicit FTPS (FTP over TLS).