How to migrate vaultwarden
Background
I’ve recently updated my Vaultwarden instance in my home lab and wanted yo migrate all the previous data.
Yes, you can export the vault from the UI, but I had several users and don’t have access to their accounts, so I needed another way to migrate everything to the new instance.
For context, I run Vaultwarden in an Ubuntu LXC in my Proxmox server. I used tteck’s awesome scripts to install it.
Hey look! A newsletter!
Each week, I share lessons learned, actionable business tips, practical life advice, and highlights from my journey, directly to your inbox.
By submitting this form, you'll be signed up to my free newsletter. You can opt-out at any time with no hard feelings 😉 Here's our privacy policy if you like reading.
Here’s how to migrate your Vaultwarden data
1. Backup the original data
- SSH into wherever you have Vaultwarden installed
- Locate the
data
directory. Depending on your Vaultwarden version, thedata
folder can either be in:/opt/vaultwarden/data
/var/lib/vaultwarden/data
- Copy all the contents inside of
data
to a safe directory. I copied them to my local machine usingscp
.
2. Migrate the data to a new Vaultwarden instance
- Install the new Vaultwarden instance
- Stop Vaultwarden
systemctl stop vaultwarden
- Remove the default data dir
sudo rm -r /opt/vaultwarden/data
- Copy the current data over (I used SCP but you can use any file transfer system you like)
- Remove the old RSA keys from the
data
directory. These will be recreated
sudo rm /opt/vaultwarden/data/rsa_key.pem
sudo rm /opt/vaultwarden/data/rsa_key.pub.pem
- Change the directory ownership to vaultwarden
sudo chown -R vaultwarden:vaultwarden /opt/vaultwarden/data
- Restart Vaultwarden
sudo systemctl start vaultwarden
Done!
You should now be able to reach Vaultwarden at the endpoint you’ve set it up and have all of your old data.
Tags:
dev opensource ubuntu vaultwarden bitwarden