Keeping bash history in sync using atuin and a self-hosted sync server

I read an interesting blogpost today, entitled “I quit my job to work full time on my open source project”.

I’m full of respect for someone who does this - I know what it’s like to quit employment and set up on your own, as I did this eight years ago now, walking away from job as an employed lawyer to start our own law firm - and, well, the project itself looks amazingly useful too: keeping bash (and other shell) history in sync, across multiple machines.

That project is atuin.

I’ve actually got a feeling that I heard of it last year, perhaps, but I didn’t do anything with it at the time.

Today, I decided to give it a go.

The atuin client can help with bash history search on its own, but since I often move between machines, having multiple machines in sync sounds very useful.

So I wanted the sync functionality but, even though it is encrypted, I’d prefer to run my own sync server, so I did that first.

Setting up the server


The server is the same as client, and the official installation method is a piped remote bash script:

bash <(curl --proto '=https' --tlsv1.2 -sSf

I reviewed it, and it boiled down to:

LATEST_RELEASE=$(curl -L -s -H 'Accept: application/json'

LATEST_VERSION=$(echo "$LATEST_RELEASE" | sed -e 's/.*"tag_name":"\([^"]*\)".*/\1/')

echo "$LATEST_VERSION/atuin_${LATEST_VERSION//v/}_amd64.deb"

curl -Lo /tmp/atuin.deb "$LATEST_VERSION/atuin_${LATEST_VERSION//v/}_amd64.deb"

sudo apt install /tmp/atuin.deb

And then adding an entry to ~/.bashrc.

This seemed sensible, and safe, enough, so I ran the installer.


It uses postgresql as the database:

sudo apt install postgresql postgresql-contrib -y

sudo systemctl enable --now postgresql

sudo -u postgres createuser atuin

sudo -u postgres createdb -O atuin atuindb

sudo -u postgres psql

alter user atuin with encrypted password 'use-a-better-password-than-this';


atuin server config

atuin needs a server config file (which is different to the client config file):

mkdir -p ~/.config/atuin/

tee ~/.config/atuin/server.toml <<EOF
host = ""
port = 8888
open_registration = true

Note that this will do http (not https) over port 8888. Since the server is non-public, and the history is encrypted, I felt that not using https was a suitable tradeoff for now. I might change that in future.

Obviously, there were firewall configurations to change too, to allow in (select) traffic to 8888.


You can test the server with atuin server start. It worked.

I want the server to run on boot, as my user, so I created a systemd profile(?) for it:

sudo tee /lib/systemd/system/atuin.service <<EOF
Description=Run atuin as user neil

ExecStart=/usr/bin/atuin server start


sudo systemctl daemon-reload

sudo systemctl enable --now atuin.service

sudo systemctl status atuin.service

And it worked. Excellent.


Setting up the clients is easier.

First client

And that was it.

Second client

On the first client:

On the second client I did:

Using it

I look forward to seeing how it works for me in practice!