HELP FILE

Use the LastPass Command Line Application

The LastPass command line application makes it easier for you to get to data stored in LastPass via the terminal on Mac, Linux, and Windows using Cygwin. This brings both better security and convenience by allowing you to access, add, modify, and delete entries in your online LastPass Vault, all from the terminal. You can also generate passwords for every server you use and securely store those passwords directly in LastPass. LastPass Enterprise features are supported as well, including Shared Folders. Find detailed information in the manual.

The command line application is hosted on Github at https://github.com/LastPass/lastpass-cli. Additionally, you can report issues at https://github.com/LastPass/lastpass-cli/issues.

Topics in this article:

Create, edit, and retrieve passwords via the command line

Automate sharing

lpass subcommands

Create, edit, and retrieve passwords via the command line

Users who prefer the command line can access their data directly with “lpass ls” then using “lpass show -c –password Sitename” to put the Sitename password on the copy buffer. You can utilize “lpass show” to store passwords used in scripts, rather than putting passwords in the scripts themselves. LastPass can also be used as you work within the command line to help you log in to servers. We’ve included some example scripts in the contrib directory of the archive.

LastPass users can also use the command line to log in to other machines as they work. There are examples such as contrib/examples/change-ssh-password.sh which show automated password changing on a server. You can run it automatically on a nightly basis, regularly changing the password on the server as a security measure.

Automate sharing

Use the “lpass share” commands to manage shared folders as follows:

  • Create a new shared folder using “lpass share create”
  • Query existing users with “lpass share userls”
  • Add new users with “lpass share useradd”.

The standard “lpass generate” command works with shared folders, so you can easily create sites and share with multiple users using lpass. For more information, please see the manual for more shared folder commands.

lpass subcommands

lpass, like git, is comprised of several subcommands:

  • lpass login [--trust] [--plaintext-key [--force, -f]] USERNAME
  • lpass logout [--force, -f]
  • lpass show [--sync=auto|now|no] [--clip, -c] [--all|--username|--password|--url|--notes|--field=FIELD|--id|--name] {UNIQUENAME|UNIQUEID}
  • lpass ls [--sync=auto|now|no] [GROUP]
  • lpass edit [--sync=auto|now|no] [--non-interactive] {--name|--username|--password|--url|--notes|--field=FIELD} {NAME|UNIQUEID}
  • lpass generate [--sync=auto|now|no] [--clip, -c] [--username=USERNAME] [--url=URL] [--no-symbols] {NAME|UNIQUEID} LENGTH
  • lpass duplicate [--sync=auto|now|no] {UNIQUENAME|UNIQUEID}
  • lpass rm [--sync=auto|now|no] {UNIQUENAME|UNIQUEID}
  • lpass sync [--background, -b]

You can view the full documentation in the manpage, ‘man lpass‘ or view the online manual.