Skip to content

Instantly share code, notes, and snippets.

@jwalterclark
Created January 27, 2019 21:10
Show Gist options
  • Select an option

  • Save jwalterclark/b35e9fd14604bc68420545c1f3343050 to your computer and use it in GitHub Desktop.

Select an option

Save jwalterclark/b35e9fd14604bc68420545c1f3343050 to your computer and use it in GitHub Desktop.
Basic alternative to LastPass-SSH
#!/usr/bin/env bash
lpass ls "Secure Notes\\SSH" | tail -n +2 | while read line; do
name=$(sed 's/^[^\/]*\/\(.*\) \[id: [0-9]*\]$/\1/' <<< $line)
id=$(sed 's/^[^\/]*\/.* \[id: \([0-9]*\)\]$/\1/' <<< $line)
lpass show --field 'Private Key' $id > $HOME"/.ssh/"$name
chmod 600 $HOME"/.ssh/"$name
lpass show --field 'Public Key' $id > $HOME"/.ssh/"$name".pub"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment