For services managed by systemd, use credentials instead of environment variables as the default way to deliver passwords, tokens, and other sensitive inputs. systemd makes each credential available as a named file in a service-specific directory; the service reads its path from CREDENTIALS_DIRECTORY. For deployment artifacts that should be encrypted at rest, create them with systemd-creds encrypt and load them with LoadCredentialEncrypted=.
This improves how a secret is stored and scoped, but it does not hide the plaintext from the service that needs to use it. The service must still be able to read the value while running, so pair credentials with least privilege and suitable service sandboxing.
Why environment variables are a poor default for secrets
Environment variables remain useful for ordinary configuration. For secrets, however, they have important drawbacks: they are inherited by child processes by default, have size limits, and are awkward for binary data. A secret placed in an environment can therefore spread to processes that do not need it.
Systemd credentials provide a different interface: named, immutable data items scoped to a service activation and made available as files. The systemd project describes them as an alternative to environment variables and simple unencrypted files for sensitive service inputs. Its documentation says, “Service credentials are acquired at the moment of service activation, and released on service deactivation.” Systemd Credentials documentation
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minutePC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11#1 Best Overall
- Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
- Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
- Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
- Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
- 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
The credential mechanism improves delivery and scoping; it is not a guarantee that a secret stays encrypted while the service uses it. Systemd decrypts encrypted credentials for the service at activation, and the service receives plaintext it can read. systemd.exec manual
Load a credential into a system service
Choose between loading a protected plaintext source file and loading an encrypted credential artifact. In either case, the application reads the resulting file from the credential directory.
| Directive | Use it when | What the service receives |
|---|---|---|
LoadCredential=name:/path/to/source |
The source file is already stored with appropriate protection and encrypted deployment artifacts are not required. | The named credential as a file in the service credential directory. |
LoadCredentialEncrypted=name:/path/to/file.cred |
You want the stored or deployed credential artifact encrypted with systemd-creds. | Systemd decrypts and authenticates it at activation, then supplies the plaintext named file. |
If decryption or authentication fails for an encrypted load directive, the service fails to start. Systemd Credentials documentation
Rank #2
- 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
- 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
- Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
- 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
- What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
1. Create an encrypted artifact
Encrypt the secret using the same credential name you will use in the unit. A basic workflow is:
systemd-creds encrypt --name=db-password /secure/input/db-password db-password.cred
Here, db-password is the credential name, /secure/input/db-password is the plaintext source, and db-password.cred is the encrypted output. Keep the output in an appropriate protected deployment location. The credential name is embedded in encrypted data to help prevent accidental use for a different purpose. Check systemd-creds --help and the installed manual before relying on options: available switches and defaults vary by systemd release. systemd-creds manual
Rank #3
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
2. Add it to the unit
In the service unit’s [Service] section, add:
LoadCredentialEncrypted=db-password:/secure/deploy/db-password.cred
The name before the colon is the name the service will use to open the credential; the path after it points to the encrypted artifact. To load a protected plaintext source instead, use LoadCredential=db-password:/secure/source/db-password.
3. Read the service credential directory
Have the application read $CREDENTIALS_DIRECTORY/db-password. Do not hardcode /run/credentials/<unit>: that assumption does not work for user services. If the application accepts a file path as an argument and does not discover the directory itself, systemd’s %d specifier can provide the credential-directory path in the unit. Systemd Credentials documentation
Rank #4
- Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
- Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
- Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
- Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
- Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
Choose encryption for your deployment and recovery plan
Systemd-creds can authenticate and encrypt credentials with a TPM2-derived key, a host key stored in /var/lib/systemd/credential.secret, or a combination. The manual describes AES256-GCM for confidentiality and integrity. These choices bind a credential to different parts of a machine, so decide how it should behave during migration, rebuilds, or hardware replacement before encrypting it. systemd-creds manual
| Protection choice | Operational consequence | Consider it when |
|---|---|---|
| TPM2-derived key | Credential is bound to machine hardware and requires the relevant TPM to be available. | The secret should not simply move to another host, and hardware-bound provisioning fits the service. |
| Persistent host key | Credential depends on access to the host installation’s root-only /var/lib/systemd/credential.secret. |
You can protect and preserve that host key across the expected lifetime of the deployment. |
| Combined TPM2 and host key | When both are available, automatic mode ordinarily combines them, requiring the local hardware and OS installation to decrypt. Migration and recovery become more involved. | You want both hardware and installation binding, and have a plan to reprovision or recover after changes. |
These defaults and available switches are version-sensitive. The upstream manual notes a systemd v262 change related to pinning encrypted credentials to the TPM2 Storage Root Key, so confirm behavior against the manual installed on the target system rather than assuming a command behaves identically across releases. systemd-creds manual
System services, user services, and early boot
- System manager: use the ordinary system target when encrypting credentials for system services.
- Per-user manager: the current upstream manual specifies
systemd-creds encrypt --userfor credentials intended for user services. - Initrd or early-boot generators: if a generator runs before
/varis mounted, use an initrd-compatible key choice such asauto-initrdwhen appropriate. This is a specialized boot scenario, not a general service default.
Do not pass sensitive credential values through the kernel command line: systemd’s credentials documentation notes that command-line values can be visible in userspace through /proc/cmdline. Systemd Credentials documentation
Free tools Windows power users keep installed
One-click scans. No signup required.
Best Value
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
Limit runtime exposure with service isolation
A running service must read its credential in plaintext, so credentials do not prevent the service from disclosing or misusing its own secret. Limit who can see the runtime credential files with least privilege and mount namespacing. The systemd project identifies PrivateMounts=yes as a minimal measure that makes the service’s runtime credential directory invisible to other services; several other sandboxing settings imply private mounts. Systemd Credentials documentation
Do not put a sensitive literal in SetCredential=: unit files are world-readable. Reserve that directive for non-sensitive values. Where embedding an encrypted payload in the unit is appropriate, use SetCredentialEncrypted= instead. Systemd Credentials documentation
Likewise, a null-key encryption mode provides neither confidentiality nor authenticity. It is a provisioning convenience, not secure encryption. systemd-creds manual
Plan for image cloning and key rotation
If you build machine images, treat the host credential key and encrypted credentials as a lifecycle pair. Systemd’s image-building guidance says to remove /var/lib/systemd/credential.secret from a prepared image so that deployed instances do not share the same secret. But removing that key also means credentials previously encrypted with it can no longer be decrypted. Re-provision or re-encrypt credentials as part of instance setup; do not assume ciphertext from a template will remain portable after changing the key. Safely Building Images
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Before choosing a mode or automating rotation, answer these operational questions:
- Must the encrypted artifact work on another host, or should it be machine-bound?
- Will the TPM be available to the service manager when the credential is loaded?
- Will
/var/lib/systemd/credential.secretpersist through rebuilds and restores? - Is the consumer a system service, a per-user service, or an initrd process?
- How will you issue a replacement credential if hardware, the OS installation, or the key changes?
When to use plaintext loading instead
LoadCredential= is a reasonable choice when the source file is already protected and your deployment does not need an encrypted credential artifact. LoadCredentialEncrypted= is useful when encrypted-at-rest deployment files are part of the threat model and the intended key is available when systemd activates the service. Both approaches provide plaintext to the service at runtime; encryption at rest does not remove that requirement. Systemd Credentials documentation systemd-creds manual
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

