ssh-lastpass/README.md

30 lines
1.6 KiB
Markdown
Raw Normal View History

2019-02-07 13:49:53 -05:00
# Purpose
This script allows you to ssh to a server using an SSH Key and passphrase pulled from your lastpass account.
2019-02-07 14:51:01 -05:00
# ssh.sh Script
## Requirements
2019-02-07 13:49:53 -05:00
This script requires the `lastpass-cli` and `expect` packages.
The SSH Key must be stored in your lastpass account, as a Secure Note of the type SSH Key, with the Private Key and Passphrase fields filled out, at a minimum.
2019-02-07 14:51:01 -05:00
## Usage
2019-02-07 13:49:53 -05:00
1. Download the script to a location of your choosing, ensuring it is executable
2. run it like this: ```./ssh.sh KEYNAME server-you-wish-to-ssh-to```
2019-02-07 14:51:01 -05:00
## How it works
2019-02-07 13:49:53 -05:00
This script uses the official `lastpass-cli` package to pull the private key to a file and the private key passphrase to a variable. The script then uses that information to ssh to the requested server, and removes the private key when the connection is closed.
2019-02-07 14:51:01 -05:00
# ssh-copy-id.sh Script
## Requirements
This script requires the `lastpass-cli` package.
The SSH Key must be stored in your lastpass account, as a Secure Note of the type SSH Key, with the Private Key and Public Key fields filled out, at a minimum.
## Usage
1. Download the script to a location of your choosing, ensuring it is executable
2. run it like this: ```./ssh-copy-id.sh KEYNAME server-you-wish-to-ssh-to```
3. You will be prompted to answer if you would like to remove all old ssh keys currently installed on the remote host. This is strongly recommended.
## How it works
This script uses the official `lastpass-cli` package to pull the public and private keys to files. The script then uses that information to run `ssh-copy-id` to requested server, and removes the key files when the connection is closed.