WindowsmacOSLinux

Where Does ADB Store Keys and Backups?

ADB keeps its host key pair in ~/.android/adbkey, while backup archives land wherever your -f flag pointed.

Last updated

ADB splits its files by role. The host key pair that your phone trusts lives in a fixed dot folder in your home directory, created automatically on first server start. Backup archives are the opposite: they go exactly where your -f flag says, defaulting to the current directory.

That split explains two classic confusions. A new key pair means the phone prompts for authorization again, and a missing .ab file usually means the terminal was in a different folder than assumed.

Where Android Debug Bridge stores this, by platform

Windows
%USERPROFILE%\.android\adbkey

Host private key with adbkey.pub beside it. Delete both and restart the server to trigger a fresh authorization prompt on the phone. Backup .ab files default to the folder the terminal was in when you ran adb backup.

macOS
~/.android/adbkey

Same key pair layout. The ANDROID_SDK_HOME variable can relocate the whole .android folder. Point -f at an explicit path like ~/backups/phone.ab so archives never land somewhere surprising.

Linux
~/.android/adbkey

Same arrangement. An .ab file is a compressed tar with a 24 byte header, so standard unzip tools choke on it; use an abe style extractor or strip the header first.

Frequently asked questions

where did my adb backup file go

Wherever your shell was standing. Without -f, adb backup writes backup.ab into the current directory. Rerun with adb backup -f ~/phone.ab to put the next one somewhere deliberate.

why is my phone asking to authorize adb again

The host key changed. A fresh ~/.android/adbkey was generated, or you switched users or machines. Accept the prompt on the phone and the new key is remembered.

how do i open an ab backup file

Strip the 24 byte header and decompress the rest as gzip into a tar, or use an Android Backup Extractor jar. Encrypted backups need the password you set when creating them.

Notice an outdated path? Let us know.