Official Bitwarden cli client
Install
cd /tmp/
wget 'https://vault.bitwarden.com/download/?app=cli&platform=linux' -O bw.zip
unzip bw.zip
mv bw /usr/local/bin
Arch / Manjaro:
sudo pacman -S bitwarden-cli
Debian:
apt update
apt-get install mise
mise use -g bitwarden
Alpine container
bw
fails inalpine:3.20.3
: lots ofError relocating …: symbol not found
errors- Related: Error relocating /usr/lib/libcurl.so.4: SSL_get0_group_name: symbol not found
After installing libstdc++
and libgcc
alpine packages I can't get further
than:
Error relocating /root/.local/share/mise/installs/bitwarden/2024.10.0/bin/bw: fcntl64: symbol not found
Configure
- config file at
~/.config/Bitwarden\ CLI/data.json
Configure endpoint:
bw config server bw.example.com
Export env vars by adding them to ~/.config/shell/common/env_local
, i.e.
BW_ORG
:
bw list organizations
Usage
Login:
Logging in with email and password is recommended for interactive sessions
bw login
Unlock safe:
bw unlock
export BW_SESSION="…"
List personal items:
bw list items
Get item by id:
bw get item de08464b-b2c5-4564-8ed3-213110bc9a6c
Collections
If you are trying to perform user management on your organization, you won’t be able to use the BW CLI. The CLI is designed to work with your vault contents, but user management or other organizational management tasks must be performed using the web vault interface, and cannot be accomplished using the Bitwarden app, browser extension, or CLI.
List org-collections:
bw list --pretty --organizationid $BW_ORG org-collections
Get org-collections template:
bw get template org-collection --pretty
Backup / export
- The UI client can only export personal items, not organisation items.
- Backup/export organisation vault
- None of the export methods export the personal folders where the items are stored.
csv
Important: CSV-export doesn't always export all items, without any notice !! I exported my test-vault (5 items) to json and csv: The json file contained all entries, while the csv file only contained 2 !
CSV-Format:
collections,type,name,notes,fields,reprompt,login_uri,login_username,login_password,login_totp
bw export --organizationid $BW_ORG --output ~/backups/bitwarden/ --format csv
Json
Json export contains much more details, like:
collections
passwordHistory
revisionDate
creationDate
deletedDate
id
organizationId
folderId
type
(integer: probably login, card, identity etc.)favorite
collectionIds
bw export --organizationid $BW_ORG --output ~/backups/bitwarden/ --format json
Issues
Other
Performance
Comparism of time spent fetching a password:
Tool | milliseconds |
---|---|
bw | 3689 |
rbw | 11 |
gopass | 26 |