Skip to main content
The mullvad import-settings and mullvad export-settings commands allow you to backup and restore your VPN configuration as JSON files.

export-settings

Export current settings to a JSON file.

Usage

mullvad export-settings <FILE>
FILE
string
required
Output file path. Use - to write to standard output.

Examples

Export to file:
mullvad export-settings my-settings.json
Export to stdout:
mullvad export-settings - | jq .
Backup with timestamp:
mullvad export-settings "settings-$(date +%Y%m%d).json"

import-settings

Import settings from a JSON file.

Usage

mullvad import-settings <FILE>
FILE
string
required
Input file path. Use - to read from standard input.

Examples

Import from file:
mullvad import-settings my-settings.json
Import from stdin:
cat my-settings.json | mullvad import-settings -
Apply settings on new machine:
# On old machine
mullvad export-settings settings.json

# Transfer file to new machine
scp settings.json newhost:

# On new machine
mullvad account login YOUR_ACCOUNT
mullvad import-settings settings.json

Settings format

The exported JSON file contains:
  • Relay constraints (location, providers, ownership)
  • Tunnel settings (protocol, obfuscation, quantum resistance)
  • DNS configuration
  • Split tunneling rules
  • Auto-connect preference
  • LAN access setting
  • Lockdown mode setting
  • Custom lists

Example settings file

{
  "relay_settings": {
    "normal": {
      "location": {
        "only": {
          "country": "se"
        }
      },
      "tunnel_protocol": "wireguard"
    }
  },
  "tunnel_options": {
    "wireguard": {
      "mtu": 1380,
      "quantum_resistant": "auto"
    }
  },
  "dns_options": {
    "state": "default",
    "default_options": {
      "block_ads": true,
      "block_trackers": true
    }
  },
  "auto_connect": true,
  "allow_lan": false,
  "block_when_disconnected": false
}

What is NOT included

  • Account token (you must log in separately)
  • Device information
  • WireGuard keys
  • Logs or cached data
  • API access methods (stored separately)
  • Beta program preference
Settings files do not contain account credentials. You must log in before or after importing settings.

Use cases

Backup before changes

# Backup current config
mullvad export-settings backup-before-changes.json

# Make changes
mullvad relay set location us
mullvad dns set custom 1.1.1.1

# Restore if needed
mullvad import-settings backup-before-changes.json

Replicate configuration

# Export on primary device
mullvad export-settings shared-config.json

# Import on all other devices
for host in laptop desktop phone; do
  scp shared-config.json $host:
  ssh $host 'mullvad import-settings shared-config.json'
done

Version control

# Track settings in git
mkdir -p ~/.config/mullvad-backups
cd ~/.config/mullvad-backups
git init

mullvad export-settings current.json
git add current.json
git commit -m "Update VPN settings"

Automation

#!/bin/bash
# Automated backup script
BACKUP_DIR="$HOME/mullvad-backups"
mkdir -p "$BACKUP_DIR"

# Daily backup with rotation
mullvad export-settings "$BACKUP_DIR/settings-$(date +%Y%m%d).json"

# Keep only last 30 days
find "$BACKUP_DIR" -name 'settings-*.json' -mtime +30 -delete

reset-settings

Reset all settings to defaults while keeping logs and account login.

Usage

mullvad reset-settings [OPTIONS]
-y, --assume-yes
flag
Skip confirmation prompt.

Examples

Interactive reset:
mullvad reset-settings
Non-interactive:
mullvad reset-settings -y

What gets reset

  • All relay constraints (back to auto)
  • Tunnel options (protocol, obfuscation, quantum resistance)
  • DNS settings
  • Split tunneling rules
  • Custom lists
  • Auto-connect (off)
  • LAN access (blocked)
  • Lockdown mode (off)

What persists

  • Account login status
  • Device registration
  • Logs
  • Cached relay list
Use reset-settings when you want a clean configuration but don’t want to log out or lose logs. Use factory-reset for a complete reset including account logout.

Merging settings

Imported settings are merged with current settings:
  • Specified fields are updated
  • Unspecified fields keep current values
  • This allows partial configuration updates

Partial update example

{
  "auto_connect": true,
  "allow_lan": true
}
Importing this file only changes auto-connect and LAN settings, leaving all other settings unchanged.

Exit status

  • 0 - Success
  • 1 - File error, invalid JSON, or daemon error
  • 2 - User cancelled (reset-settings only)
  • factory-reset - Complete reset including account
  • All set commands - Configure individual settings

Build docs developers (and LLMs) love