Simple temporary file uploads over SSH

e594fce Warn about age

~smlavine pushed to ~smlavine/tmp git

2 months ago

f0e89d9 Condense copyright information

~smlavine pushed to ~smlavine/tmp git

1 year, 6 months ago


Note: This is an old, incomplete design that I don't work on anymore. It is unfinished and will likely always be.

Simple temporary file uploads over SSH.

This is still in the design stage. No code has been written yet.


... | ssh tmp@tmp.example.com


tmp is a simple service for temporary file uploads over SSH. The file to be uploaded is provided to ssh as stdin, and upon successful upload a link to the file will be put to stdout. On an error, like exceeding a size limit, a message will be put to stderr.


A custom time limit can be provided:

$ cat report.pdf | ssh tmp@tmp.example.com 14d
$ cat LICENSE | ssh tmp@tmp.example.com 2m

By default, files are deleted 2 days after they are uploaded.

A custom file name can be provided:

$ cat wow.mp3 | ssh tmp@tmp.example.com 1w wow.mp3
$ curl https://sr.ht/~smlavine/tmp | ssh tmp@tmp.example.com 2d tmp

The name cannot be more than 128 bytes long, and each character in the name must match the regex /[a-zA-Z]_-\./. Notice, no spaces. A file ending will be appended if one is not provided.

By default, a file is given a randomly generated name. Characters in the name are from the string "abcdefghijkmnpqrstuvwxyz23456789". Letters and numbers that might cause confusion with others in the set are removed.


For guidance on how to install tmp on a server, see SETUP.md.


A custom name cannot be provided unless a custom time limit is also provided. Another way of designing this could have been to use options instead:

$ ... | ssh tmp@tmp.example.com -- -t 1w -n file.txt

The -- is necessary to prevent ssh from parsing the -t as its own. This syntax is a bit too long for my liking, but I may consider instead persuing something like

$ ... | ssh tmp@tmp.example.com t=1w n=file.txt
$ ... | ssh tmp@tmp.example.com n=recording.mp4 foo=baz bar

Options and arguments are exposed to the program server-side through the SSH_ORIGINAL_COMMAND environment variable. Spaces within arguments cannot be differentiated from the separation of arguments, so spaces cannot be included in any command line input to tmp.

Copyright (C) 2021 Sebastian LaVine mail@smlavine.com

Licensed under the AGPLv3. See LICENSE.