How To Install lastpass-cli on Ubuntu 20.04

In this tutorial we learn how to install lastpass-cli on Ubuntu 20.04. lastpass-cli is command line interface to LastPass.com

Introduction

In this tutorial we learn how to install lastpass-cli on Ubuntu 20.04.

What is lastpass-cli

lastpass-cli is:

This application is a command line interface to the LastPass.com services. It 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.

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 login to servers. We’ve included some example scripts below.

The new tool is beneficial for LastPass users who want to use the command line to login to other machines as they work. There are examples such as contrib/examples/change-ssh-password.sh which shows automated password changing on a server. You could run it automatically on a nightly basis, regularly changing the password on the server as a security measure.

There are three methods to install lastpass-cli on Ubuntu 20.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install lastpass-cli Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install lastpass-cli using apt-get by running the following command:

sudo apt-get -y install lastpass-cli

Install lastpass-cli Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install lastpass-cli using apt by running the following command:

sudo apt -y install lastpass-cli

Install lastpass-cli Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install lastpass-cli using aptitude by running the following command:

sudo aptitude -y install lastpass-cli

How To Uninstall lastpass-cli on Ubuntu 20.04

To uninstall only the lastpass-cli package we can use the following command:

sudo apt-get remove lastpass-cli

Uninstall lastpass-cli And Its Dependencies

To uninstall lastpass-cli and its dependencies that are no longer needed by Ubuntu 20.04, we can use the command below:

sudo apt-get -y autoremove lastpass-cli

Remove lastpass-cli Configurations and Data

To remove lastpass-cli configuration and data from Ubuntu 20.04 we can use the following command:

sudo apt-get -y purge lastpass-cli

Remove lastpass-cli configuration, data, and all of its dependencies

We can use the following command to remove lastpass-cli configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge lastpass-cli

References

Summary

In this tutorial we learn how to install lastpass-cli package on Ubuntu 20.04 using different package management tools: apt, apt-get and aptitude.