In the last post, I walked through the process of setting up the command line password manager called pass. In this post, we’re going to set up a git repository to store the passwords on.

Server Setup

To store passwords on a server, all you need to install on the server is openssh and git.

These commands should be run on the server. First, let’s make a directory to hold our password repo.

cd /
mkdir -p /srv/git

In case you were wonder, I’m running all of these commands as the root user.

Now, let’s create the git user which will have access to this directory and which will be used to sign in to our password store.

useradd git -d /srv/git

And, let’s make sure our git user has permissions to that directory

chown git:git /srv/git

Now, let’s change to being the git user and then initialize a bare repository.

git init --bare /srv/git/passwordstore.git

Now, let’s make sure the ssh port is open on the server.

ufw allow 22

Pushing Passwords To The Server

Now we are ready to push the password store.

We’ll run these commands on the client.

pass git remote add origin git@<ip or hostname of server>:/srv/git/passwordstore.git

First, let’s copy our ssh key to the server (so we don’t have to specify a password).

ssh-copy-id -i ~/.ssh/id_rsa.pub

Now we should be able to push the repo.

pass git push

In the next post, I’ll walk you through how to set up an Android client so that you can access passwords from your mobile phone.