PIPE2TMPFILE(1)
π NAME π
pipe2tmpfile β bestie, it's literally the little tool that lets commands who are so picky about needing a real file work with data coming through a pipe π«Ά
No cap, that's the whole vibe. She's a section 1 girlie (a user command, in the group chat of your shell).
β¨ SYNOPSIS β¨
echo input | pipe2tmpfile <command> @@keyfile@@ [additional args...]
So here's the tea β: the <command> runs with a temporary file holding everything you piped in, and wherever you wrote @@keyfile@@, that gets swapped out for the actual temporary file path. One token, one glow-up, periodt. π
πΈ DESCRIPTION πΈ
pipe2tmpfile is that friend who bridges the gap between commands that spit data out to stdout and commands that demand an actual file as input β because apparently some of them have never heard of a pipe. π
Here's the routine, step by step:
- It reads data from standard input.
- It writes that data to a secure temporary file.
- It executes the command you specified, with the temporary file path substituted in for the
@@keyfile@@token.
It's highkey the moment when you're working with sensitive data β like cryptographic keys or passwords β that absolutely should not be written to permanent storage. The temporary file gets automatically deleted once the command finishes running, so no sensitive data is left chilling on your disk. Clean up, no crumbs. β¨
π EXAMPLE π
Signing a file with a minisign key that lives in SPHINX? Iconic. Watch this:
getpwd | sphinx get minisig://user1 minisign-test-key | pipe2tmpfile minisign -S -s @@keyfile@@ -m filetosign
Let's break down what that command is doing, because it ate and left no crumbs:
- Prompts for your master password via
getpwd - Retrieves the minisign private key from SPHINX
- Writes the key to a secure temporary file
- Runs
minisignto signfiletosignusing the temporary key file - Automatically deletes the temporary key file
Five steps, zero evidence left behind. It's giving main character energy. π
π SECURITY CONSIDERATIONS π
Okay bestie, listen up because this part actually matters. Since the output of SPHINX is generally sensitive, it is advised not to write it to permanent storage. So pipe2tmpfile tries to store it in a temporary file storage spot instead.
By default, that's under /run/user/$(id -u). π«£
But you're not locked in β users can provide an alternative path to store these files by setting the environment variable keyroot. Set it, slay it, done.
And fr fr: the temporary files are deleted after the execution of the command. Always. That's the whole point. π
π REPORTING BUGS π
Found a bug? Not the vibe, but it happens. Tell the devs here:
https://github.com/stef/pwdsphinx/issues/
π AUTHOR π
Written by Stefan Marsiske. King behavior. π
π COPYRIGHT π
Copyright Β© 2024 Stefan Marsiske. License GPLv3+: GNU GPL version 3 or later https://gnu.org/licenses/gpl.html. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
(That last bit is in all caps on purpose, bestie β it's the legally dramatic part. π)
π¦ SEE ALSO π¦
That's literally it β pipe in, temp file out, nothing left on disk, and that's the manual page for pipe2tmpfile(1), straight from the pipe2tmpfile source, matched up with its date. Stay safe out there with your secrets, mwah π
πβ¨
π¦ where this page comes from
- nixos 26.05: pwdsphinx 2.0.4
- nixpkgs unstable: pwdsphinx 2.0.4
- ubuntu stonking: pwdsphinx-tools 2.0.4-1 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms