Back Up SMS, Call Logs & Contacts on Android Using ADB and OpenSSL (No Root)

11 min read Learn a safe, command‑line method to back up your SMS, call logs and contacts on Android, encrypt the data with OpenSSL, and restore it later – all without rooting your device. October 11, 2026 07:00 How to Back Up SMS, Call Logs & Contacts via ADB + OpenSSL (No Root)

What you’ll achieve

When you travel, change phones, or simply want a safety net, losing SMS messages, call history or contacts can be frustrating. Android’s built‑in backup options often miss these items or store them in the cloud where you have limited control. This tutorial shows you how to pull the raw SQLite databases that hold SMS, call logs and contacts directly from the device, bundle them into a single archive, and encrypt the archive with openssl. The result is a portable, password‑protected backup that you can store on a computer, external drive, or cloud service of your choice. All steps use standard ADB commands and OpenSSL, so no rooting, third‑party apps, or special device firmware are required.

Before you start

  • Computer: Windows, macOS or Linux with adb (Android Platform‑Tools) installed and added to your PATH.
  • OpenSSL: Most Linux/macOS systems have it pre‑installed. Windows users can install the binary from Win32 OpenSSL or use the Windows Subsystem for Linux (WSL).
  • USB cable: A good quality data cable; charging‑only cables will not work.
  • Device preparation: Enable Developer options and turn on USB debugging. See the step below for the exact menu path.
  • Backup destination: Choose a folder on your computer where you have write permission. Example: C:\AndroidBackups or ~/android_backups.
  • Security note: The encryption password protects the backup, but you must remember it. Losing the password means the data cannot be recovered.

Step‑by‑step backup

1. Enable USB debugging on the phone

Open Settings → About phone → tap Build number seven times until you see “You are now a developer”. Then go back to Settings → System → Developer options and toggle USB debugging on. Confirm any security prompt that appears.

2. Verify the ADB connection

  1. Connect the phone to the computer via USB.
  2. Open a terminal (Command Prompt, PowerShell, Terminal, etc.).
  3. Run adb devices. You should see a line like XXXXXX device. If the status reads unauthorized, check the phone for a dialog asking to allow USB debugging and tap Allow.

When the device appears as device, you are ready to pull files.

3. Pull the SMS database

SMS messages are stored in /data/data/com.android.providers.telephony/databases/mmssms.db. Because the /data partition is not directly readable, we use adb pull with the run-as trick for apps that allow it, or we use adb backup as a fallback. The most reliable method works on most stock Android devices:

  1. Run adb shell "run-as com.android.providers.telephony cat /data/data/com.android.providers.telephony/databases/mmssms.db" > sms_backup.db. This streams the file to your current directory.
  2. If run-as returns “Permission denied”, fall back to adb backup -f sms.ab -noapk com.android.providers.telephony. Then extract the .ab file with openssl (see the optional section at the end).

After a successful pull, you will have a file named sms_backup.db on your computer.

4. Pull the Call Log database

The call history lives in /data/data/com.android.providers.contacts/databases/contacts2.db. The same run-as technique works:

  1. Run adb shell "run-as com.android.providers.contacts cat /data/data/com.android.providers.contacts/databases/contacts2.db" > calllog_backup.db.
  2. If the command fails, repeat the adb backup approach with the package com.android.providers.contacts.

The resulting file calllog_backup.db contains both contacts and call‑log tables. We will later extract only the call‑log portion, but keeping the full database is useful for a complete restore.

5. Pull the Contacts database

Contacts are stored in the same contacts2.db file we just retrieved. To keep the process simple, we will reuse that file for both contacts and call logs. If you prefer a separate copy, repeat the command from step 4 and rename the output to contacts_backup.db.

6. Bundle the files into a single archive

Having three separate files makes encryption a bit more cumbersome. Use tar (available on macOS/Linux) or 7‑Zip on Windows to create a single archive:

# macOS / Linux
mkdir backup_tmp && mv sms_backup.db calllog_backup.db contacts_backup.db backup_tmp/
cd backup_tmp
tar -cvf ../android_sms_calls_contacts.tar *.db
cd ..
rm -r backup_tmp

# Windows (PowerShell with 7‑Zip in PATH)
mkdir backup_tmp
move sms_backup.db calllog_backup.db contacts_backup.db backup_tmp\
7z a -tzip android_sms_calls_contacts.zip backup_tmp\*
rd /s /q backup_tmp

The resulting android_sms_calls_contacts.tar (or .zip) file contains all three databases.

7. Encrypt the archive with OpenSSL

OpenSSL’s AES‑256‑CBC cipher offers strong symmetric encryption. Run the following command, replacing YOUR_PASSWORD with a passphrase you will remember (quotes are optional but help with spaces):

# Linux / macOS
openssl enc -aes-256-cbc -salt -in android_sms_calls_contacts.tar -out android_sms_calls_contacts.tar.enc -k "YOUR_PASSWORD"

# Windows (PowerShell)
openssl enc -aes-256-cbc -salt -in android_sms_calls_contacts.zip -out android_sms_calls_contacts.zip.enc -k "YOUR_PASSWORD"

After execution you will see a new file ending with .enc. This file is unreadable without the correct password.

Never store the password in the same location as the encrypted file. Use a password manager or write it down in a secure place.

8. Verify the encrypted backup

It’s a good habit to test decryption before you delete the original unencrypted archive. Run:

# Linux / macOS
openssl enc -d -aes-256-cbc -in android_sms_calls_contacts.tar.enc -out test_decrypt.tar -k "YOUR_PASSWORD"

tar -tf test_decrypt.tar

# Windows (PowerShell)
openssl enc -d -aes-256-cbc -in android_sms_calls_contacts.zip.enc -out test_decrypt.zip -k "YOUR_PASSWORD"
7z l test_decrypt.zip

If the tar -tf (or 7z l) command lists sms_backup.db, calllog_backup.db and contacts_backup.db, the encryption succeeded. You can now safely delete the unencrypted .tar / .zip file.

9. Store the encrypted backup safely

  • Copy the .enc file to an external hard drive or a cloud folder that you trust.
  • Consider keeping two copies in different locations (e.g., one local, one cloud) to guard against hardware failure.
  • Periodically refresh the backup after major changes (new contacts, many SMS, etc.).

How to restore the data (optional)

Restoring is essentially the reverse of the backup process. You need the same password and a device with USB debugging enabled.

1. Decrypt the archive

# Linux / macOS
openssl enc -d -aes-256-cbc -in android_sms_calls_contacts.tar.enc -out android_sms_calls_contacts.tar -k "YOUR_PASSWORD"

# Windows (PowerShell)
openssl enc -d -aes-256-cbc -in android_sms_calls_contacts.zip.enc -out android_sms_calls_contacts.zip -k "YOUR_PASSWORD"

2. Extract the databases

# Linux / macOS
tar -xvf android_sms_calls_contacts.tar

# Windows (PowerShell)
7z e android_sms_calls_contacts.zip

3. Push the databases back to the device

Because the target locations are inside /data, we need run-as again. Run each command separately:

# SMS
adb push sms_backup.db /data/local/tmp/
adb shell "run-as com.android.providers.telephony cat /data/local/tmp/sms_backup.db > /data/data/com.android.providers.telephony/databases/mmssms.db"

# Call logs & contacts (both in contacts2.db)
adb push contacts_backup.db /data/local/tmp/
adb shell "run-as com.android.providers.contacts cat /data/local/tmp/contacts_backup.db > /data/data/com.android.providers.contacts/databases/contacts2.db"

After pushing, you may need to clear the data cache for the affected apps or simply reboot the device so the system reloads the new databases.

If run-as fails, you can use adb backup with the -apk flag to restore the entire package, but this will also overwrite other data belonging to the provider.

Troubleshooting

  • ADB not recognized: Ensure the Platform‑Tools folder is in your system PATH. Restart the terminal after adding it.
  • Device shows "unauthorized": Re‑connect the USB cable, unlock the phone, and tap Allow on the debugging prompt. If the prompt never appears, toggle USB debugging off and on again.
  • run-as returns "Permission denied": Some OEMs lock down run-as. In that case use adb backup to create a backup file (.ab) and extract it with android-backup-extractor (a Java tool). The extractor is outside the scope of this guide but widely documented.
  • OpenSSL command not found: Install OpenSSL via your package manager (brew install openssl, sudo apt install openssl) or download the Windows binary.
  • Decryption fails with "bad decrypt": Verify you typed the exact same password. OpenSSL is case‑sensitive and treats whitespace literally.
  • After restore, messages are missing: Some Android versions cache SMS data in memory. Reboot the phone after the restore to force the system to read the new database.

Safety and best‑practice notes

  • Always keep your phone charged above 50 % before starting a backup. A sudden power loss can corrupt the pulled files.
  • Do not share the encrypted backup file without also sharing the password through a secure channel.
  • If you plan to keep the backup for years, consider re‑encrypting it with a new password every 2–3 years to mitigate potential cryptographic advances.
  • Test the restore process on a spare device or emulator before relying on the backup for critical data.

By following these steps you gain full control over your personal communication data, protect it with strong encryption, and avoid dependence on cloud services that may change policies or disappear. The workflow works on virtually any Android 6.0+ device, regardless of manufacturer, as long as USB debugging is available.

User Comments (0)

Add Comment
We'll never share your email with anyone else.