This is a public pastebin server. You may upload files up to 10MB in size and have them shared publically. FTP is used to upload files to the server.
The very minimal code needed for this server is open sourced under the 3-Clause BSD License and can be found further down on this page or at this git repo. The full license can be found at paste.cf/LICENSE.md
I often paste things (code, text, logs, pics, gifs, etc) I want to share with friends, forums, or irc online, but it feels like every time I got used to a pastebin or imagehosting site it went down or had major issues within a year or two. So I figured I could spare a few dollars a month on a vps to host my own paste server as that's the only way you KNOW it will last.
Turns out all the paste server software out there I could find was very bloated. A paste server doesn't need frameworks, dynamic servers, ads, fluff, a web gui, fonts, or complex slow clients. FTP, an HTTP server, inotify, cron, and 2 <100 line scripts is the most it should ever be. That will ensure your paste server never requires more than a cheap $5 vps even with thousands of uploads per day.
Uploading to paste.cf is quite simple. Using your favourite FTP client
cd incoming (the
public upload directory), and
put file.whatever then
sha1sum on your file and the public address will be
Your pastes will be deleted eventually. Storage space costs money; if you need your files hosted forever read the section below and have your own private server running very easily.
To make uploading a bit quicker I wrote a tiny client that FTPs the file
to the server, calculates the hash, and prints what the resulting url
should be. Basically
pcf notes.md will return the (soon to
be) live url. Then you can download the client here or scroll further
down to read the code. Obviously you can combine
other programs to do cool stuff. Like take a screenshot, upload it, and
put the url in your clipboard.
scrot -q 85 scrot.png && pcf
scrot.png | xclip -in -selection c At some point I plan on
creating a video showing off some usage of paste.cf.
This server runs an FTP server configured to allow public uploads into a specific directory. It also runs a simple static web server. That public FTP directory is watched for linux inotify updates with incrond. Incrond is configured to run a python script (found below) when new files are placed in the public FTP directory. The script only does a few things. First it checks that the file is under 10Mb (the size can be specified). Then it caculates the sha1sum of the file and renames + moves the file into the web server's public directory (wherever you specify that to be).
Additionally the server uses cron to run another script once every hour. This script checks if the disk usage is above a certain percentage, if so it deletes uploaded files based on age That script can also be found below.
With basic computer knowledge you should be able to duplicate this server for yourself (and even have your own private version if you'd like). Below are basic setup instructions as well as the aforementioned scripts.
adduser --no-create-home pastewill do that.
systemctl status crond, figure out how the init system on your operating system works and this should be pretty simple.
chmod +x rename.py. Do the same thing for remove.py.
su paste, then edit your incron tab with
incrontab -eso that it says something like
/public/ftp/directory/here/ IN_CLOSE_WRITE,IN_MOVE_TO /path/to/rename.py --file $# --hold /public/ftp/directory --web /public/web/directory --max 10. Read
rename.py --helpfor more info. If you we're unable to run
incrontab -eyou probably need to add your username to
web_dirvariable at the top points to the webdirectory with all the pictures. Then you can simply place the script in
/etc/cron.hourly/if that doesn't exist on your system you'll need to also edit your cron tab to run that script once per hour.
Do not upload anything which must remain private to paste.cf as everything that is uploaded is public.
Additionally anything you upload may be removed at any time so do not rely on paste.cf as your only copy of something important. The fact that things can be removed does not guarantee their removal. In fact virtually any uploaded file could be crawled and archived elsewhere.
Finally it should be noted that the FTP server running on paste.cf is configured to log IPs for each uploaded file. Meaning if illegal content is uploaded and the authories send me a letter I'm handing them your IP. I'm a broke ass college student and I'm simply not interested in fighting your legal battles for you.
You have been warned. If you need to upload something private or permanent follow the instructions above and setup your own paste server. A server just like this one can be rented for $5 a month and give you and your mates plenty of bandwidth and storage.