LinuxCommandLibrary

systemd-creds

Manage encrypted service credentials

TLDR

Encrypt file with name

$ systemd-creds encrypt --name [name] [input] [output]
copy
Decrypt file
$ systemd-creds decrypt [input] [output]
copy
Encrypt from stdin
$ echo -n [text] | systemd-creds encrypt --name [name] - [output]
copy
Encrypt with pretty format for unit files
$ echo -n [text] | systemd-creds encrypt --name [name] --pretty - - >> [unit.service]
copy
Create credential with expiry
$ systemd-creds encrypt --not-after "[timestamp]" [input] [output]
copy

SYNOPSIS

systemd-creds [OPTIONS] COMMAND

DESCRIPTION

systemd-creds manages encrypted credentials for systemd services. Credentials are encrypted secrets that can be securely passed to services via the `$CREDENTIALS_DIRECTORY` mechanism.
Credentials can be encrypted with the host key, TPM2, or both. They support time-based expiry and can be embedded directly in unit files using the `--pretty` format.

PARAMETERS

--name= NAME

Set credential name
--pretty
Output in format suitable for unit files
--not-after= TIMESTAMP
Set credential expiry time
--with-key= TYPE
Encryption key source (host, tpm2, etc.)

COMMANDS

encrypt INPUT OUTPUT

Encrypt a credential
decrypt INPUT OUTPUT
Decrypt a credential
list
List available credentials
cat CREDENTIAL
Show credential content

CAVEATS

Host-encrypted credentials are tied to the specific machine. TPM2-encrypted credentials require TPM hardware. Credentials must be decrypted by systemd, not manually accessible to services.

HISTORY

systemd-creds was added to provide secure secret management for services, replacing environment variables and world-readable files for storing sensitive configuration.

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community