LinuxCommandLibrary

lpass

Manage passwords stored in LastPass

TLDR

Log in to your LastPass account, by entering your master password when prompted

$ lpass login [username]
copy

Show login status
$ lpass status
copy

List all sites grouped by category
$ lpass ls
copy

Generate a new password for gmail.com with the identifier myinbox and add to LastPass
$ lpass generate --username [username] --url [gmail.com] [myinbox] [password_length]
copy

Show password for a specified entry
$ lpass show [myinbox] --password
copy

SYNOPSIS

lpass [options]

PARAMETERS

login
    Logs into your LastPass account.

logout
    Logs out of your LastPass account.

status
    Shows the current login status.

show
    Shows the password and other details for the given entry name.

username
    Shows the username for the given entry name.

password
    Shows the password for the given entry name.

note
    Shows the note for the given entry name.

ls
    Lists the names of all entries in your LastPass vault.

add
    Adds a new entry to your LastPass vault.

edit
    Edits an existing entry in your LastPass vault.

rm
    Removes an entry from your LastPass vault.

generate []
    Generates a random password of the specified length (default is 20).

sync
    Syncs your local LastPass vault with the LastPass servers.

--plain-text
    Displays secrets in plain text (less secure).

--clip
    Copies the value to the clipboard.

import
    Import passwords from a file.

--help
    Show help about the command.

DESCRIPTION

The `lpass` command is a command-line interface for accessing and managing your LastPass password vault. It allows you to retrieve usernames, passwords, notes, and other sensitive information stored in your LastPass account directly from your terminal, making it suitable for scripting, automation, and advanced users who prefer a command-line workflow. With `lpass`, you can add, edit, and delete entries in your vault, as well as generate secure passwords. It supports various authentication methods, including username/password, multifactor authentication, and trusted devices. `lpass` provides a secure and efficient way to interact with your LastPass vault without relying on a web browser. It enables integration with other command-line tools and scripts to automate password management tasks. Before using `lpass`, you need to login to your LastPass account using `lpass login`.

CAVEATS

Storing passwords in plain text, even temporarily (e.g., using `--plain-text`), can be a security risk.
Be mindful of shell history and how your shell saves command history as it can save commands including passwords.

SECURITY CONSIDERATIONS

While `lpass` provides a convenient way to access your LastPass vault from the command line, it's crucial to consider the security implications. Avoid storing passwords in scripts or configuration files. Use environment variables or other secure mechanisms to manage sensitive information. Always keep your LastPass client updated to benefit from the latest security patches.

SEE ALSO

gpg(1), ssh(1)

Copied to clipboard