paste-service.html - www.codemadness.org - www.codemadness.org saait content files
 (HTM) git clone git://git.codemadness.org/www.codemadness.org
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
       paste-service.html (3245B)
       ---
            1 <!DOCTYPE html>
            2 <html dir="ltr" lang="en">
            3 <head>
            4         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
            5         <meta http-equiv="Content-Language" content="en" />
            6         <meta name="viewport" content="width=device-width" />
            7         <meta name="keywords" content="www, ssh" />
            8         <meta name="description" content="Howto setup your own secure file paste service" />
            9         <meta name="author" content="Hiltjo" />
           10         <meta name="generator" content="Static content generated using saait: https://codemadness.org/saait.html" />
           11         <title>Setup your own file paste service - Codemadness</title>
           12         <link rel="stylesheet" href="style.css" type="text/css" media="screen" />
           13         <link rel="stylesheet" href="print.css" type="text/css" media="print" />
           14         <link rel="alternate" href="atom.xml" type="application/atom+xml" title="Codemadness Atom Feed" />
           15         <link rel="alternate" href="atom_content.xml" type="application/atom+xml" title="Codemadness Atom Feed with content" />
           16         <link rel="icon" href="/favicon.png" type="image/png" />
           17 </head>
           18 <body>
           19         <nav id="menuwrap">
           20                 <table id="menu" width="100%" border="0">
           21                 <tr>
           22                         <td id="links" align="left">
           23                                 <a href="index.html">Blog</a> |
           24                                 <a href="/git/" title="Git repository with some of my projects">Git</a> |
           25                                 <a href="/releases/">Releases</a> |
           26                                 <a href="gopher://codemadness.org">Gopherhole</a>
           27                         </td>
           28                         <td id="links-contact" align="right">
           29                                 <span class="hidden"> | </span>
           30                                 <a href="feeds.html">Feeds</a> |
           31                                 <a href="pgp.asc">PGP</a> |
           32                                 <a href="mailto:hiltjo@AT@codemadness.DOT.org">Mail</a>
           33                         </td>
           34                 </tr>
           35                 </table>
           36         </nav>
           37         <hr class="hidden" />
           38         <main id="mainwrap">
           39                 <div id="main">
           40                         <article>
           41 <header>
           42         <h1>Setup your own file paste service</h1>
           43         <p>
           44         <strong>Last modification on </strong> <time>2018-03-10</time>
           45         </p>
           46 </header>
           47 
           48 <h2>Setup SSH authentication</h2>
           49 <p>Make sure to setup SSH public key authentication so you don't need to enter a
           50 password each time and have a more secure authentication.</p>
           51 <p>For example in the file $HOME/.ssh/config:</p>
           52 <pre><code>Host codemadness
           53         Hostname codemadness.org
           54         Port 22
           55         IdentityFile ~/.ssh/codemadness/id_rsa
           56 </code></pre>
           57 <p>Of course also make sure to generate the private and public keys.</p>
           58 <h2>Shell alias</h2>
           59 <p>Make an alias or function in your shell config:</p>
           60 <pre><code>pastesrv() {
           61         ssh user@codemadness "cat &gt; /your/www/publicdir/paste/$1"
           62         echo "https://codemadness.org/paste/$1"
           63 }
           64 </code></pre>
           65 <p>This function reads any data from stdin and transfers the output securely via
           66 SSH and writes it to a file at the specified path. This path can be visible via
           67 HTTP, gopher or an other protocol. Then it writes the absolute URL to stdout,
           68 this URL can be copied to the clipboard and pasted anywhere like to an e-mail,
           69 IRC etc.</p>
           70 <h2>Usage and examples</h2>
           71 <p>To use it, here are some examples:</p>
           72 <p>Create a patch of the last commit in the git repo and store it:</p>
           73 <pre><code>git format-patch --stdout HEAD^ | pastesrv 'somepatch.diff'
           74 </code></pre>
           75 <p>Create a screenshot of your current desktop and paste it:</p>
           76 <pre><code>xscreenshot | ff2png | pastesrv 'screenshot.png'
           77 </code></pre>
           78 <p>There are many other uses of course, use your imagination :)</p>
           79 
           80                         </article>
           81                 </div>
           82         </main>
           83 </body>
           84 </html>