"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
config: add password sub command for setting obscured passwords
Substantiel2423fa40e267
diff --git a/cmd/config/config.go b/cmd/config/config.goindex c1fffad3d..90033dedd 100644--- a/cmd/config/config.go+++ b/cmd/config/config.go@@ -16,6 +16,7 @@ func init() {configCommand.AddCommand(configCreateCommand)configCommand.AddCommand(configUpdateCommand)configCommand.AddCommand(configDeleteCommand)+ configCommand.AddCommand(configPasswordCommand)}var configCommand = &cobra.Command{@@ -121,3 +122,20 @@ var configDeleteCommand = &cobra.Command{fs.DeleteRemote(args[0])},}++var configPasswordCommand = &cobra.Command{+ Use: "password <name> [<key> <value>]+",+ Short: `Update password in an existing remote.`,+ Long: `+Update an existing remote's password. The password+should be passed in in pairs of <key> <value>.++For example to set password of a remote of name myremote you would do:++ rclone config password myremote fieldname mypassword+`,+ RunE: func(command *cobra.Command, args []string) error {+ cmd.CheckArgs(3, 256, command, args)+ return fs.PasswordRemote(args[0], args[1:])+ },+}diff --git a/fs/config.go b/fs/config.goindex c23c02107..62c8f6483 100644--- a/fs/config.go+++ b/fs/config.go@@ -1034,6 +1034,24 @@ func CreateRemote(name string, provider string, keyValues []string) error {return UpdateRemote(name, keyValues)}+// PasswordRemote adds the keyValues passed in to the remote of name.+// keyValues should be key, value pairs.+func PasswordRemote(name string, keyValues []string) error {+ if len(keyValues) != 2 {+ return errors.New("found key without value")+ }+ // Suppress Confirm+ Config.AutoConfirm = true+ passwd := MustObscure(keyValues[1])+ if passwd != "" {+ configData.SetValue(name, keyValues[0], passwd)+ RemoteConfig(name)+ ShowRemote(name)+ SaveConfig()+ }+ return nil+}+// JSONListProviders prints all the providers and options in JSON formatfunc JSONListProviders() error {b, err := json.MarshalIndent(fsRegistry, "", " ")