secret-tool
can be used to store and retrieve secrets from libsecret.
The package containing secret-tool
needs to be installed:
apt -y install libsecret-tools
To store passwords:
secret-tool store --label='Some secret to store' <attribute name> <lookup key>
You will then be prompted for the password to store. The attribute + lookup key needs to be unique.
As an example, to store a secret for accessing a database:
secret-tool store --label='MySQL Database db02' password mysql_db02
To retrieve passwords:
secret-tool lookup <attribute name> <lookup key>
To lookup the database password stored above:
secret-tool lookup password mysql_db02