Top Related Projects
The command line vault (Windows, macOS, & Linux).
Unofficial Bitwarden compatible server written in Rust, formerly known as bitwarden_rs
The slightly more awesome standard unix password manager for teams
KeePassXC is a cross-platform community-driven port of the Windows application “Keepass Password Safe”.
Free cross-platform password manager compatible with KeePass
Quick Overview
LastPass CLI is an official command-line interface for LastPass password manager. It allows users to manage their LastPass vault, including adding, editing, and retrieving passwords and other secure information, directly from the terminal.
Pros
- Provides secure, scriptable access to LastPass vault
- Supports multi-factor authentication
- Integrates well with other command-line tools and scripts
- Offers a faster alternative to the web interface for power users
Cons
- Limited compared to the full web interface
- Requires command-line proficiency
- May have a steeper learning curve for non-technical users
- Doesn't support all features available in the web or mobile apps
Code Examples
- Logging in to LastPass:
lpass login username@example.com
- Adding a new entry to the vault:
lpass add --non-interactive --username=user@example.com --password=secretpassword --url=https://example.com "Example Site"
- Retrieving a password:
lpass show --password "Example Site"
- Generating a secure password:
lpass generate --username=user@example.com "New Site" 20
Getting Started
-
Install LastPass CLI:
- On macOS:
brew install lastpass-cli
- On Ubuntu:
sudo apt-get install lastpass-cli
- On macOS:
-
Log in to your LastPass account:
lpass login username@example.com
-
Sync your vault:
lpass sync
-
List all items in your vault:
lpass ls
-
Retrieve a password:
lpass show --password "Site Name"
Remember to log out when finished:
lpass logout
Competitor Comparisons
The command line vault (Windows, macOS, & Linux).
Pros of Bitwarden CLI
- Open-source and self-hostable, offering greater control over data
- More active development and larger community support
- Cross-platform compatibility (Windows, macOS, Linux)
Cons of Bitwarden CLI
- Slightly more complex setup process
- Fewer built-in integrations with third-party tools
Code Comparison
LastPass CLI:
lpass login username
lpass show -c --password Sitename
lpass generate -c --username=username --url=example.com Site 16
Bitwarden CLI:
bw login
bw get password itemname --session SESSION_KEY
bw generate -l 16 --uppercase --lowercase --number
Key Differences
- Bitwarden CLI offers more granular control over password generation
- LastPass CLI has a simpler login process
- Bitwarden CLI requires session management for extended use
Community and Support
- Bitwarden has a more active GitHub repository with frequent updates
- LastPass CLI has a longer history but less frequent updates
- Bitwarden offers more comprehensive documentation and user guides
Integration and Extensibility
- LastPass CLI integrates well with existing LastPass ecosystem
- Bitwarden CLI provides better options for custom scripting and automation
- Both offer command-line interfaces suitable for integration into development workflows
Unofficial Bitwarden compatible server written in Rust, formerly known as bitwarden_rs
Pros of Vaultwarden
- Open-source, self-hosted alternative to Bitwarden, offering more control over data
- Supports multiple users and organizations
- Lighter resource requirements, suitable for running on low-powered devices
Cons of Vaultwarden
- Requires self-hosting and maintenance, which may be challenging for non-technical users
- May lack some advanced features present in LastPass CLI
- Potential security risks if not properly configured and maintained
Code Comparison
Vaultwarden (Rust):
#[get("/sync")]
fn sync(headers: Headers, conn: DbConn, nt: Notify) -> JsonResult {
let user = headers.user;
let data = user.load_data(&conn)?;
Ok(Json(SyncData::build_json(&data, &nt, &conn, &user)))
}
LastPass CLI (C):
static int lastpass_cli_login(const char *username, const char *password)
{
struct session *session = NULL;
int ret;
ret = lastpass_login(&session, username, password, NULL, NULL, lastpass_cli_agent(), 0);
if (ret)
return ret;
return session_save(session, legacy_session_cache_path());
}
The code snippets demonstrate different approaches: Vaultwarden uses Rust with a web framework, while LastPass CLI is written in C for command-line operations. Vaultwarden's code focuses on API endpoints, while LastPass CLI handles direct login functionality.
The slightly more awesome standard unix password manager for teams
Pros of gopass
- Open-source and self-hosted, providing full control over password storage
- Supports multiple users and teams with built-in sharing capabilities
- Offers a more extensive feature set, including password generation and Git integration
Cons of gopass
- Steeper learning curve due to more complex setup and configuration
- Requires manual synchronization between devices (though Git can help)
- Less widespread adoption compared to LastPass, potentially limiting third-party integrations
Code Comparison
LastPass CLI:
# Retrieve a password
lpass show --password "My Account"
# Add a new entry
lpass add --non-interactive "New Entry" Username Password
gopass:
# Retrieve a password
gopass show my-account
# Add a new entry
gopass insert --generate my/new-entry
Both tools offer command-line interfaces for password management, but gopass provides a more Git-like experience with its command structure. LastPass CLI focuses on simplicity, while gopass offers more advanced features at the cost of increased complexity.
KeePassXC is a cross-platform community-driven port of the Windows application “Keepass Password Safe”.
Pros of KeePassXC
- Open-source and self-hosted, providing full control over password data
- Cross-platform support (Windows, macOS, Linux) with a user-friendly GUI
- Offers additional features like password generation and secure notes
Cons of KeePassXC
- Requires manual syncing between devices (no built-in cloud sync)
- Less seamless integration with web browsers compared to LastPass
Code Comparison
KeePassXC (C++):
void Database::setKey(const CompositeKey& key)
{
m_key = key;
m_kdf->randomize();
m_masterSeed = randomGen()->randomArray(32);
}
LastPass CLI (C):
char *lastpass_get_output(const char *command)
{
char *output = NULL;
size_t output_len = 0;
FILE *child = popen(command, "r");
// ... (code to read output)
pclose(child);
return output;
}
KeePassXC focuses on local password management with a robust GUI, while LastPass CLI provides command-line access to cloud-based password storage. KeePassXC offers more control and privacy, but LastPass CLI may be more convenient for users who prefer cloud synchronization and command-line operations.
Free cross-platform password manager compatible with KeePass
Pros of KeeWeb
- Cross-platform desktop application with a user-friendly graphical interface
- Supports multiple password database formats, including KeePass
- Offers offline access to password databases
Cons of KeeWeb
- Lacks command-line interface for automation and scripting
- May have a steeper learning curve for users unfamiliar with KeePass-style databases
Code Comparison
KeeWeb (JavaScript):
const kdbxweb = require('kdbxweb');
const db = kdbxweb.Kdbx.create(credentials, 'My Database');
const entry = db.createEntry(db.getDefaultGroup());
entry.fields.set('Title', 'My Entry');
entry.fields.set('Password', kdbxweb.ProtectedValue.fromString('secret'));
LastPass CLI (C):
lpass_add_account(username, password, NULL, 0, &err);
lpass_add_note(name, note, NULL, 0, &err);
lpass_sync(NULL, &err);
KeeWeb is a feature-rich, cross-platform password manager with a graphical interface, while LastPass CLI offers a command-line tool for LastPass integration. KeeWeb provides more flexibility in terms of database formats and offline access, but LastPass CLI excels in automation and scripting capabilities. The choice between the two depends on user preferences for interface, database format, and integration requirements.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
LastPass CLI
(c) 2014-2019 LastPass.
Command line interface to LastPass.com.
Operating System Support
lpass
is designed to run on GNU/Linux, Cygwin and Mac OS X.
Dependencies
- LibreSSL or OpenSSL
- libcurl
- libxml2
- pinentry (optional)
- AsciiDoc (build-time documentation generation only)
- xclip, xsel, pbcopy, or putclip from cygutils-extra for clipboard support (optional)
Installing on Linux
Arch
- A binary package is available from the community repository, use pacman to simple install lastpass-cli.
- Can be build from source with the "lastpass-cli-git" *Arch User Repository (AUR). Information about installing packages from the AUR can be found on the Arch wiki.
# from community repository
sudo pacman -S lastpass-cli
# from AUR repository
packer -S lastpass-cli-git
Fedora
- Packages are available in Fedora 22 and later.
sudo dnf install lastpass-cli
Red Hat/Centos
- Packages are available in EPEL for RHEL/CentOS 7 and later.
sudo yum install lastpass-cli
- For older versions: Install the needed build dependencies, and then follow instructions in the 'Building' section.
sudo yum install openssl libcurl libxml2 pinentry xclip openssl-devel libxml2-devel libcurl-devel gcc gcc-c++ make cmake
Debian/Ubuntu
-
Install the needed build dependencies, and then follow instructions in the 'Building' section.
-
For Ubuntu 16.04 (xenial)
apt-get --no-install-recommends -yqq install \
bash-completion \
build-essential \
cmake \
libcurl3 \
libcurl3-openssl-dev \
libssl1.0.0 \
libssl-dev \
libxml2 \
libxml2-dev \
pkg-config \
ca-certificates \
xclip
- For Debian (stable/oldstable) and other Ubuntus < 18.04
apt-get --no-install-recommends -yqq install \
bash-completion \
build-essential \
cmake \
libcurl3 \
libcurl3-openssl-dev \
libssl1.0 \
libssl1.0-dev \
libxml2 \
libxml2-dev \
pkg-config \
ca-certificates \
xclip
- For Debian (testing/experimental) and Ubuntu >= 18.04
apt-get --no-install-recommends -yqq install \
bash-completion \
build-essential \
cmake \
libcurl4 \
libcurl4-openssl-dev \
libssl-dev \
libxml2 \
libxml2-dev \
libssl1.1 \
pkg-config \
ca-certificates \
xclip
Gentoo
- Install the package:
sudo emerge lastpass-cli
Other Linux Distros
Install the packages listed in the Dependencies section of this document, and then follow instructions in the 'Building' section.
Installing on OS X
With Homebrew (easiest)
- Install Homebrew, if necessary.
- Update Homebrew's local formula cache:
brew update
- Install the lastpass-cli formula:
brew install lastpass-cli
With MacPorts
- Install MacPorts, if necessary.
- Update MacPorts' local ports tree:
sudo port selfupdate
- Install the lastpass-cli port:
sudo port install lastpass-cli
- Optionally install the documentation:
sudo port install lastpass-cli-doc
Manually
Install the packages listed in the Dependencies section of this document, and then follow instructions in the 'Building' section.
Installing on FreeBSD
- Install the binary package:
sudo pkg install security/lastpass-cli
- Or build the port yourself:
sudo make -C /usr/ports/security/lastpass-cli all install clean
Installing on Cygwin
- Install apt-cyg
- Using apt-cyg, install the needed build dependencies, and then follow instructions in the 'Building' section.
apt-cyg install wget make cmake gcc-core gcc-g++ openssl-devel libcurl-devel libxml2-devel libiconv-devel cygutils-extra
Building
$ make
Under the covers, make invokes cmake in a build directory; you may also use cmake directly if you need more control over the build process.
Installing
$ sudo make install
These environment variables can be passed to make to do the right thing: PREFIX
, DESTDIR
, BINDIR
, LIBDIR
, MANDIR
.
Running
If you've installed it:
$ lpass
Otherwise, from the build directory:
$ ./lpass
Documentation
Install asciidoc
and xsltproc
if they are not already installed.
$ sudo apt-get install asciidoc xsltproc
The install-doc
target builds and installs the documentation.
$ sudo make install-doc
Once installed,
$ man lpass
You can view the full documentation in the manpage, man lpass
or view it online.
Top Related Projects
The command line vault (Windows, macOS, & Linux).
Unofficial Bitwarden compatible server written in Rust, formerly known as bitwarden_rs
The slightly more awesome standard unix password manager for teams
KeePassXC is a cross-platform community-driven port of the Windows application “Keepass Password Safe”.
Free cross-platform password manager compatible with KeePass
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot