Skip to content

jamesjoshuahill/lastpass-ssh-key

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Load an SSH key for the day using LastPass CLI

At Pivotal we share Mac workstations, so we typically log in for the day.

I used to carry my SSH key on a USB stick. Now it's a backup and I load my SSH key using LastPass.

Prerequisites

  1. LastPass account
  2. LastPass CLI: brew install lastpass-cli

Set up

  1. Create a new SSH key; GitHub has a decent guide

  2. Put the private key in the notes field of a LastPass secure note, e.g. "Personal/GitHub SSH key"

  3. Customise the load script, with your own variables

  4. Put your custom load script in the notes field of another LastPass secure note, e.g. "Personal/Load GitHub SSH Key"

Usage

lpass login $USERNAME

# Load your SSH key until hometime!
bash <(lpass show 'Personal/Load GitHub SSH Key' --notes)

# Or, load your SSH key for 2 hours!
bash <(lpass show 'Personal/Load GitHub SSH Key' --notes) 2

Bash profile

For convenience we've added a function to our bash profile:

load_ssh_key() {
  if lpass status; then
    bash <(lpass show 'Personal/Load GitHub SSH Key' --notes) "$1"
  fi
}

About

Load an SSH key for the day using LastPass CLI

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages