Add canister access control for another computer

When creating a canister, one gets a default identity that becomes the owner of the canister.
What if my computer breaks or I want to manage the canister from another computer?

How do I copy the ‘default’ identity so that it is useable elsewhere?

1 Like

You can find all your dfx identities under the ~/.config/dfx/identity directory. The private key .pem files are stored here. (It would be wise to back this up.)

1 Like

Thanks @Ori This is just what I was looking for and assumed it was somewhere deeper :laughing:


@Ori, i recently had to reboot my machine. Before doing that I saved my dfx identities, but now, after rebooting and installing dfx, I didnt find a way to use the old identity.

Do you (or anyone else) know how to use the other identity?

If you copied the keys from here you should be able to just overwrite them with the ones you had before? Create a default again, go in and change the contents of the keys in that folder.

1 Like

As @apotheosis says, you can just copy the directories from your backup back to .config/dfx/identity. You can also rename the directories if you want and dfx will use those names in the ‘dfx identity’ command (‘dfx identity list’ will show them all).

You may need to create/deploy a local project on your new machine for the identity directory to show up, or you can just create it manually.


Thank you both for the answers.

Since this thread is revived already I’ll mention a new feature in dfx:

If a) you don’t want to navigate to the identities folder manually or b) you have an encrypted identity and want to access the decrypted .pem file, then you can use dfx identity export and save the output. E.g. dfx identity export alice > alice.pem

And to get the identity back into dfx: dfx identity import alice alice.pem. If you add --disable-encryption, the identity will NOT be encrypted by a password.

1 Like