LinuxCommandLibrary

kwallet-query

Query and manage KDE Wallet contents

TLDR

List all entries in the Passwords folder of kdewallet

$ kwallet-query [kdewallet] [[-l|--list-entries]]
copy

List all entries in a specific folder
$ kwallet-query [kdewallet] [[-l|--list-entries]] [[-f|--folder]] [folder_name]
copy

List all available folders
$ kwallet-query [kdewallet] [[-l|--list-entries]] [[-f|--folder]] ""
copy

Display help
$ kwallet-query [[-h|--help]]
copy

SYNOPSIS

kwallet-query [OPTIONS] [wallet_name] [folder_name] [key_name] [ACTION]

Common forms:
  kwallet-query [OPTIONS] --list-wallets
  kwallet-query [OPTIONS] [wallet_name] --list-folders
  kwallet-query [OPTIONS] [wallet_name] [folder_name] --list-keys
  kwallet-query [OPTIONS] [wallet_name] [folder_name] [key_name] --read-password
  kwallet-query [OPTIONS] [wallet_name] [folder_name] [key_name] --write-password <password>
  kwallet-query [OPTIONS] [wallet_name] [folder_name] [key_name] --remove
  kwallet-query [OPTIONS] [wallet_name] [folder_name] [key_name] --rename <new_key_name>

PARAMETERS

--list-wallets
    Lists all available wallets.

--list-folders
    Lists all folders within the specified wallet_name. If wallet_name is omitted, uses the default wallet.

--list-keys
    Lists all keys (entries) within the specified wallet_name and folder_name. If omitted, uses default wallet/folder.

--read-password
    Reads and outputs the password associated with the specified wallet_name, folder_name, and key_name.

--write-password <password>
    Writes the provided <password> to the specified key_name within the wallet_name and folder_name. Creates the key if it does not exist.

--remove
    Removes the specified key_name from the wallet_name and folder_name.

--rename <new_key_name>
    Renames the specified key_name to <new_key_name> within the wallet_name and folder_name.

--wallet <wallet_name>
    Specifies the wallet name to operate on. Defaults to 'kdewallet'.

--folder <folder_name>
    Specifies the folder name within the wallet. Defaults to 'Passwords'.

--key <key_name>
    Specifies the key name to operate on.

--auto-close
    Automatically closes the wallet after the operation is complete.

--daemon <command>
    Executes <command> after the KWallet daemon has successfully started and unlocked the wallet.

--help
    Displays a help message and exits.

--version
    Displays version information and exits.

DESCRIPTION

kwallet-query is a command-line utility designed to interact with the KDE Wallet system. It provides a non-graphical way to access, manage, and manipulate passwords and other sensitive data stored within KWallet. This tool is particularly useful for scripting, automation, or for users who prefer to manage their credentials from the terminal.

It allows users to list available wallets, list folders within a specific wallet, list keys (entries) within a folder, and perform actions such as reading, writing, renaming, or removing passwords associated with these keys. When operations require an unlocked wallet, kwallet-query communicates with the kwalletd5 daemon, which may prompt the user for the wallet's master password via a graphical dialog or, in some configurations, a console prompt.

While offering powerful command-line access, users should be mindful of the security implications, especially when displaying sensitive information directly on the terminal.

CAVEATS

kwallet-query requires the KDE Wallet daemon (kwalletd5) to be running and accessible. If the wallet is locked, the daemon will typically prompt for the wallet's master password, often via a graphical dialog, which might not be suitable for headless environments or certain scripting scenarios. Displaying passwords directly on the terminal via --read-password carries a security risk, as the output might be visible in terminal scrollback buffers or shell history.

DEFAULT WALLET AND FOLDER

By default, kwallet-query operates on the wallet named 'kdewallet' and the folder named 'Passwords' if not explicitly specified via the --wallet or --folder options, or as positional arguments.

USAGE EXAMPLES

Here are some common usage examples:

List all wallets:
kwallet-query --list-wallets

List folders in the default wallet:
kwallet-query --list-folders

Read a password from 'mykey' in 'mywallet/MyFolder':
kwallet-query mywallet MyFolder mykey --read-password

Write a new password 's3cr3tp4ss' to 'newkey' in default wallet/folder:
kwallet-query --write-password s3cr3tp4ss --key newkey

Remove 'oldkey' from 'mywallet/MyFolder':
kwallet-query mywallet MyFolder oldkey --remove

HISTORY

kwallet-query has been a part of the KDE ecosystem for a long time, evolving alongside the KDE Wallet framework itself, from its early versions (KDE 3.x, KDE 4.x) to the current KDE Plasma 5/6 iterations. Its development has consistently focused on providing a robust command-line interface to facilitate automation and scripting tasks involving the KWallet, complementing the graphical KWallet Manager application.

SEE ALSO

kwalletd5(8), kwalletmanager5(1), kded5(8)

Copied to clipboard