LastPass CLI backup to Google Drive
Written 6 years and 3 months ago
mkdir -p ~/GDrive/Backups/LastPass/`date +%Y/%m/%d` && \
lpass export | \
gpg -er omarchehab98@gmail.com > \
~/GDrive/Backups/LastPass/`date +%Y/%m/%d`/lpass-`date -u +%Y-%m-%dT%H:%M:%S`.gpg
Explained
-
mkdirCreate the directory we are backing up to (e.g.~/GDrive/Backups/LastPass/2018/12/12) -
lpass exportExports your vault as CSV -
gpgEncrypt your vault using your GPG public key-
-especifies that you are encrypting -
-rspecifies the public key you are signing the message with
-
-
Finally, we redirect the output to the folder we created
Dependencies
-
LastPass CLI (lastpass-cli)
-
OpenPGP CLI Tool (gpg)
-
Remote file system mounted locally
-
For Google Drive, I use (google-drive-ocamlfuse)
-
Any tool that mounts a remote file system locally works
-
Ideas
-
Alias the command for convenience
alias lpass-remote-export='mkdir...>...gpg' -
Run the command periodically to automate process
- You will get a popup to unlock your vault, are you okay with that? Convenience vs Security. I tend to forget to back up regularly, although a popup every once in a while is annoying, it’s a reminder to backup my vault.