LinuxmacOS

Where Does doctl Store Config and Tokens?

doctl CLI config file with contexts and tokens under ~/.config, and its overrides.

Last updated

doctl stores contexts, tokens and defaults in a config.yaml inside a doctl folder under ~/.config. First authentication writes it for you, so the file appears on its own after auth init succeeds.

Tokens in plain text make this file sensitive by nature. Environment variables outrank the file for scripting, and named contexts keep several accounts in one place for interactive use. The file holds no machine specific paths, so copies work immediately on arrival.

Where doctl stores this, by platform

Linux
~/.config/doctl/config.yaml

Respects $XDG_CONFIG_HOME when set. Holds config.yaml with auth contexts and defaults. Migrate by copying the file, or re run auth init and let doctl rewrite it.

macOS
~/.config/doctl/config.yaml

Same XDG style path as Linux. Contexts and tokens copy cleanly between the two platforms with no adjustments in normal setups.

Frequently asked questions

how do i move doctl auth to a new computer

Copy config.yaml to the same path on the new machine, or switch to DIGITALOCEAN_ACCESS_TOKEN and skip the file. Config files with tokens belong in encrypted backups, never in dotfile repos.

can doctl handle multiple accounts

Yes. doctl auth init with context flags manages named contexts in the same file, and --context picks between them per command. That beats juggling multiple config files for personal and work accounts.

Notice an outdated path? Let us know.