# Deleting wrongly encrypted history entries on server

**URL:** <https://forum.atuin.sh/t/deleting-wrongly-encrypted-history-entries-on-server/443>\
**Category:** Help\
**Created:** [July 29, 2024, 7:20pm UTC](https://forum.atuin.sh/t/deleting-wrongly-encrypted-history-entries-on-server/443 "2024-07-29T19:20:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![atuinuser](https://forum-cdn.atuin.sh/user_avatar/forum.atuin.sh/atuinuser/32/344_2.png) [@atuinuser](https://forum.atuin.sh/u/atuinuser)\
**Post date:** [July 29, 2024, 7:20pm UTC](https://forum.atuin.sh/t/deleting-wrongly-encrypted-history-entries-on-server/443/1 "2024-07-29T19:20:09Z")

</div>

I was setting up atuin on a second host and what to share history between them and before I understood how keys worked, I just created a new key (the option is called “leave blank to use an existing one”, but since there is no existing one it just creates a new one I assumed).

I realized this and installed again with the key file from the other host. However, I now have a 1 entry history record in the server which is encrypted with the wrong key (the newly generated key for the second host).

How can I delete it?

Here’s the output now when I do `antuin sync`:

```auto
$ atuin sync
Uploading 1 records to <big id A>/history
  [00:00:00] [#########################################################################################################################################################################################################################################################] 1/1 (0.0s)Downloading 6489 records from <big ID B>/history
  [00:00:23] [#################################################################################################################################################################################################################################################] 6,489/6,489 (0.0s)Downloading 1 records from <big ID C>/history
  [00:00:00] [#########################################################################################################################################################################################################################################################] 1/1 (0.0s)Error: attempting to decrypt with incorrect key. currently using k4.lid.<big id g> expecting k4.lid.<big id h>

```

I assume the error appears after the upload is associated with, my I’m not sure.

---

<div class="post-metadata">

**Author:** ![ellie](https://forum-cdn.atuin.sh/user_avatar/forum.atuin.sh/ellie/32/564_2.png) [@ellie](https://forum.atuin.sh/u/ellie)\
**Post date:** [July 30, 2024, 1:01pm UTC](https://forum.atuin.sh/t/deleting-wrongly-encrypted-history-entries-on-server/443/2 "2024-07-30T13:01:10Z")

</div>

Hey!

> [@atuinuser](#):
>
> it just creates a new one I assumed

That’s right!

Ah I see - you can resolve this with the following, though note that data encrypted with the wrong key is unrecoverable

> [@Sync v2 testing](https://forum.atuin.sh/t/sync-v2-testing/124/30):
>
> So, first I’d disable auto\_sync to make sure no hosts push bad history atuin store purge - this will delete all records in the store that cannot be decrypted with the current key atuin store verify - verify that the previous operation was successful atuin store push --force - this will delete all records stored remotely, and then push up local data. Run this on the machine that has been purged atuin store pull --force - this does the opposite to (3). Delete all local data in the store, and pu…

In future, and to anyone reading this from search engines; Please _do not_ manually copy around key files. `atuin login` has a process to automatically migrate keys if you try to login with a different one

---

<div class="post-metadata">

**Author:** ![atuinuser](https://forum-cdn.atuin.sh/user_avatar/forum.atuin.sh/atuinuser/32/344_2.png) [@atuinuser](https://forum.atuin.sh/u/atuinuser)\
**Post date:** [July 30, 2024, 4:27pm UTC](https://forum.atuin.sh/t/deleting-wrongly-encrypted-history-entries-on-server/443/3 "2024-07-30T16:27:25Z")

</div>

Thanks for the reply, I’ll try the process outlined here.

> though note that data encrypted with the wrong key is unrecoverable

That’s fine, there’s only 1 command there as I realized right away.

> [@ellie](#):
>
> Please _do not_ manually copy around key files. `atuin login` has a process to automatically migrate keys if you try to login with a different one

Hmm, I did `atuin login` but I wasn’t prompted by anything like that. How should it have worked?

---

<div class="post-metadata">

**Author:** ![ellie](https://forum-cdn.atuin.sh/user_avatar/forum.atuin.sh/ellie/32/564_2.png) [@ellie](https://forum.atuin.sh/u/ellie)\
**Post date:** [July 30, 2024, 4:38pm UTC](https://forum.atuin.sh/t/deleting-wrongly-encrypted-history-entries-on-server/443/4 "2024-07-30T16:38:05Z")

</div>

Ah, I might have understood this part

> [@atuinuser](#):
>
> I realized this and installed again with the key file from the other host

I read that as you having copied the file rather than used login, sorry!

It will have migrated the key locally but if you’ve already synced then it won’t have helped

---

<div class="post-metadata">

**Author:** ![atuinuser](https://forum-cdn.atuin.sh/user_avatar/forum.atuin.sh/atuinuser/32/344_2.png) [@atuinuser](https://forum.atuin.sh/u/atuinuser)\
**Post date:** [July 30, 2024, 4:55pm UTC](https://forum.atuin.sh/t/deleting-wrongly-encrypted-history-entries-on-server/443/5 "2024-07-30T16:55:41Z")

</div>

> [@ellie](#):
>
> I read that as you having copied the file rather than used login, sorry!

Actually I misrepresented what I did :).

I _did_ copy the key from the other host as I thought `login` would ask me for the key file, but of course login actually asks you for the key _contents_ so I just copy and pasted the key contents into the login prompt :).

Sorry for the confusion.
