Dfx constantly requires a password

After reconfiguring the accounts. Before each command in the console, dfx started asking for a password. I realized that this is from the identity.pem.encrypted file and the new settings. How do I disable *.pem encryption?

Console →

“Please enter a passphrase for your identity”:

You can use the --disable-encryption flag when you create or import an identity into dfx. WARNING: this saves your identity in plaintext on your disk. Don’t do this with identities that hold a significant amount of access/tokens.

I’m also currently working on integration with keyring/keychain so that this will not be a problem in the future.


Oh, thank you, how annoying it is to enter a password all the time. Fixed assets in securely protected:)

Indeed, the --disable-encryption command imports a public (unencrypted) private key.
But that didn’t solve the problem. I cleaned the entire cache in the Linux system, reinstalled dfx(0.11.2), even created a test (dfs new test) project - to make sure. Now it always requires a password…

It turned out that you need to use everywhere: disabled encryption:
> dfx identity import default identity.pem --disable-encryption
> dfx identity new minter --disable-encryption

Sorry if I was unclear. The encryption is defined separately per identity, so passwords are required for every identity that you didn’t create using --disable-encryption. All other identities are unaffected by the flag.


@Severin any update on this? is there a way to add this say in bashrc so it won’t constantly ask about the password? I tried to automate this but no dice. Any ideas are welcome.

As of today, you have three options:

  • --storage-mode plaintext. Never asks for a password because the PEM file is stored in plaintext. Not secure, but very convenient for testing
  • --storage-mode password-protected. Always asks for a password. PEM file is stored on disk in encrypted format
  • --storage-mode keyring: PEM file is stored in keyring/keychain. On macOS it asks for permission every time the dfx binary changes, so only very rarely

You can choose your option when you create or import your identity. To switch modes, you have to export and re-import your identity. Don’t forget to also back up your cycles wallet id(s)

1 Like