Send a Text Paste Safely with pastebinit
pastebinit sends a pipe or file straight to a public pastebin, with far less friction to notice what's actually in it. You'll finish with a repeatable way to do that and capture the returned URL. The examples match pastebinit 1.6.2, installed here as Debian package version 1.6.2-1.
The route
Jump straight to the step you need, or tick off Done means at the end.
Allow about ten minutes. You need a shell, the pastebinit package and network access to the pastebin you choose. No elevated privileges needed.
Warning
This command sends data to an external service. Never use it for passwords, private keys, access tokens, personal data or logs that contain them.
1. Check the installed command
Confirm the package and read the local option list before sending anything, all ordinary read-only commands:
$ dpkg-query -W -f='${Package} ${Version}\n' pastebinit
pastebinit 1.6.2-1
$ pastebinit -v
pastebinit v1.6.2
$ pastebinit -h
pastebinit v1.6.2
...
Usage: pastebinit [OPTION...] [FILE...]
...
The command reads standard input by default, or takes file names as arguments. The installed help reports dpaste.com as this host's default target, though distributions and configuration files can change that.
Checkpoint
Stop here if the package version or default target isn't the one you expected. Rerun pastebinit -h on the machine where the paste will actually happen.
2. Inspect the text before it leaves the machine
Prepare a small, deliberately harmless test file. This only creates a temporary file under /tmp, not a paste:
$ printf '%s\n' 'pastebinit smoke test: replace this text' > /tmp/pastebinit-demo.txt
$ sed -n '1,5p' /tmp/pastebinit-demo.txt
pastebinit smoke test: replace this text
Read the complete input before you swap in a real path. A shell pipeline can hide the source of a large document, and a file can contain credentials on a line nobody meant to share. Clean up the temporary copy once it's no longer needed:
$ rm -- /tmp/pastebinit-demo.txt
That removal is local and irreversible through the file system, but it does not remove a paste that has already been uploaded.
3. Send standard input
Once the content is genuinely safe to publish, pipe it to pastebinit. This example makes a network request and creates a paste on the selected service:
$ printf '%s\n' 'pastebinit smoke test: replace this text' | pastebinit
https://dpaste.com/EXAMPLE
The final line is the URL the pastebin returned; the identifier and URL will vary. Keep it private if the paste contains anything not meant for public discovery, a paste URL is not access control.
Don't type a shell command containing secrets directly into the pipeline. Shell history, terminal recording and process supervision can retain more than the remote service does.
4. Send a file and keep a local copy
Pass one or more file names as arguments when the input already exists:
$ pastebinit /tmp/pastebinit-demo.txt
https://dpaste.com/EXAMPLE
-i FILE does the same job for a single input. Pass more than one file and pastebinit reads and submits each non-empty document, one URL per document. Verify the local input first, especially with a wildcard involved:
$ printf 'files to send:\n'
$ printf '%s\n' /tmp/pastebinit-demo.txt
/tmp/pastebinit-demo.txt
$ pastebinit -i /tmp/pastebinit-demo.txt
https://dpaste.com/EXAMPLE
An empty input is rejected locally with You are trying to send an empty document, exiting. A missing or unreadable file is also an error. Neither should be mistaken for a successful upload.
5. Add metadata without assuming it is supported
Optional fields go through short options. Pastebinit documents these as pastebin-dependent, so a target may ignore some of them:
$ printf '%s\n' 'harmless diagnostic text' | pastebinit \
-a 'Example operator' \
-t 'Network smoke test' \
-f text \
-P 1
https://dpaste.com/EXAMPLE
-asets the author, default is the currentUSERvalue.-tsets the title, none by default.-fsets the format,textby default.-Psets the private level the target understands, default1.
These are request values, not a guarantee the service will actually make the paste private.
Warning
Don't put a password on the command line just because -u and -p exist. Command-line arguments can be visible to other local users through process inspection. Only use those options once you've checked the pastebin's authentication behaviour and the host's security policy.
6. Choose a target and list what's available
Use -b to select a configured pastebin by name:
$ printf '%s\n' 'harmless diagnostic text' | pastebinit -b dpaste.com
https://dpaste.com/EXAMPLE
List the targets this installation knows about without submitting a paste:
$ pastebinit -l
Supported pastebins:
- dpaste.com
- paste.debian.net
...
The exact list is host-specific, and user configuration can override the supplied definitions. The XML file ~/.pastebinit.xml can set a default pastebin, author, format, jabber ID and private value. Per-service files under ~/.pastebin.d can override service details, and XDG configuration and data locations are supported too. Treat these as configuration that changes where your data goes, not as harmless display preferences.
7. Diagnose a failed submission
Use verbose mode to see the selected endpoint and request parameters:
$ printf '%s\n' 'harmless diagnostic text' | pastebinit -V
POSTing to: https://dpaste.com/api/v2/
Params: ...
https://dpaste.com/EXAMPLE
Warning
Verbose output can include the text you sent, right there in the request parameters. Don't capture it in a shared log or paste it into a ticket without checking it first.
A failed network request prints an error such as Failed to contact the server and exits non-zero. Check the target with pastebinit -l, confirm DNS and connectivity, then retry only once you're sure the first request didn't actually succeed, repeating a request can create duplicate pastes.
If the target is unknown, pastebinit reports that the website isn't configured. Use a name from pastebinit -l or review the relevant .conf file, don't invent a service name and expect the tool to discover it.
Done means
- Checked the installed pastebinit version and target list.
- Inspected the exact text before sending it.
- Used stdin or an explicit file and captured the returned URL.
- Treated privacy options as service-dependent rather than a promise.
- Kept passwords, tokens, private keys and personal data out of the request.
- Know that deleting a local file cannot recall an already-created paste.