<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.8.5">Jekyll</generator><link href="https://pwntr.com/feed.xml" rel="self" type="application/atom+xml" /><link href="https://pwntr.com/" rel="alternate" type="text/html" /><updated>2019-01-31T16:58:12+01:00</updated><id>https://pwntr.com/feed.xml</id><title type="html">pwntr.com</title><subtitle>random thoughts and tutorials</subtitle><entry><title type="html">How to add a QR code to your website - or anywhere! Bitcoin donation button example</title><link href="https://pwntr.com/2016/07/17/how-to-add-a-qr-code-to-your-website-or-anywhere-bitcoin-donation-button-example/" rel="alternate" type="text/html" title="How to add a QR code to your website - or anywhere! Bitcoin donation button example" /><published>2016-07-17T19:36:00+02:00</published><updated>2016-07-17T19:36:00+02:00</updated><id>https://pwntr.com/2016/07/17/how-to-add-a-qr-code-to-your-website-or-anywhere-bitcoin-donation-button-example</id><content type="html" xml:base="https://pwntr.com/2016/07/17/how-to-add-a-qr-code-to-your-website-or-anywhere-bitcoin-donation-button-example/">&lt;p&gt;QR codes. Yes, those little rascals you’ve seen around before. Let’s create one to serve as a Bitcoin donation button for your website.&lt;/p&gt;

&lt;p&gt;Ever seen something like this guy?&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2016/07/helloworld.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;In this little tutorial we’ll create the QR code image file via command line and add a donation button along with the QR code to a website. You’ll learn two things:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Creating QR codes with any content and size straight from our beloved command line&lt;/li&gt;
  &lt;li&gt;Some bitcoin related query string syntax to open a wallet when scanning a QR code&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Alright then, let’s get right to it.&lt;/p&gt;

&lt;h1 id=&quot;requirements&quot;&gt;Requirements&lt;/h1&gt;

&lt;p&gt;Get yourself &lt;code class=&quot;highlighter-rouge&quot;&gt;qrencode&lt;/code&gt; from Kentaro Fukuchi (&lt;a href=&quot;https://github.com/fukuchi/libqrencode&quot;&gt;link&lt;/a&gt;). For the sake of simplicity, I got myself a local copy via &lt;code class=&quot;highlighter-rouge&quot;&gt;brew install qrencode&lt;/code&gt; on my MacBook. You don’t know &lt;code class=&quot;highlighter-rouge&quot;&gt;brew&lt;/code&gt;? Shame on you, get this essential piece of package managing software for your mac right &lt;a href=&quot;http://brew.sh/&quot;&gt;here&lt;/a&gt;. It’s fantastic, don’t think twice.&lt;/p&gt;

&lt;p&gt;Don’t want to run it on a mac? Good news: pretty much any distro that doesn’t smell already should ship it. Try &lt;code class=&quot;highlighter-rouge&quot;&gt;sudo apt-get install qrencode&lt;/code&gt; (Debian, Ubuntu) or &lt;code class=&quot;highlighter-rouge&quot;&gt;sudo yum install qrencode&lt;/code&gt; (RHEL, CentOS).&lt;/p&gt;

&lt;p&gt;You’re a Windows user? Try compiling &lt;code class=&quot;highlighter-rouge&quot;&gt;qrencode&lt;/code&gt; using cygwin, or use some other GUI QR generator - sorry, out of scope here.&lt;/p&gt;

&lt;h1 id=&quot;creating-the-qr-code&quot;&gt;Creating the QR code&lt;/h1&gt;

&lt;p&gt;Finally, you have &lt;code class=&quot;highlighter-rouge&quot;&gt;qrencode&lt;/code&gt; installed. Assuming you have a terminal open already, type:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;qrencode &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; helloworld.png &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; 3 &lt;span class=&quot;nt&quot;&gt;-m&lt;/span&gt; 0 &lt;span class=&quot;s1&quot;&gt;'Yeay! It works, hello world!'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This will create our image file, &lt;code class=&quot;highlighter-rouge&quot;&gt;helloworld.png&lt;/code&gt;, with 3 pixels per block (&lt;code class=&quot;highlighter-rouge&quot;&gt;-s 3&lt;/code&gt;) and no margin pixels (&lt;code class=&quot;highlighter-rouge&quot;&gt;-m 0&lt;/code&gt;) and the content &lt;code class=&quot;highlighter-rouge&quot;&gt;Yeay! It works, hello world!&lt;/code&gt;. Yep, that’s the image from the preface section.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2016/07/helloworld.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Go ahead, grab a phone and scan the code. All it will display is whatever you set to be the content. This opens endless possibilities. You can include links, raw data, or just a ton of characters (by default ~ 2950 @ 8 bits/char, see &lt;a href=&quot;https://en.wikipedia.org/wiki/QR_code#Storage&quot;&gt;here&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;qrencode&lt;/code&gt; comes with a nice man page, you should check it out for more fine tuning options (&lt;code class=&quot;highlighter-rouge&quot;&gt;man qrencode&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;TO include a URL in you QR code, just set the content to a URL. Like this:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;qrencode &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; url-qr-example.png &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; 3 &lt;span class=&quot;nt&quot;&gt;-m&lt;/span&gt; 0 &lt;span class=&quot;s1&quot;&gt;'https://pwntr.com'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Resulting in this:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2016/07/url-qr-example.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Scanning this would usually open a browser, depending on the default behavior of your scanner app.&lt;/p&gt;

&lt;p&gt;Well this was fun. Let’s create a QR code that’s a tad bit more useful in the next section.&lt;/p&gt;

&lt;h1 id=&quot;creating-a-bitcoin-donation-button&quot;&gt;Creating a bitcoin donation button&lt;/h1&gt;

&lt;p&gt;Ok, we now know how to quickly create a QR code. But how can we open someone’s wallet (pun intended) when they scan the code? Simple.&lt;/p&gt;

&lt;h2 id=&quot;query-string-shenanigans&quot;&gt;Query string shenanigans&lt;/h2&gt;

&lt;p&gt;We set the content to a specially formatted standard query string, like this one:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;bitcoin:3Qdb9iCMfzppCw4nME1Fst7Dsk7DmyuT4j?label=pwntr.com%20says%20thanks!
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;But slowly. What does this query string contain?&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;bitcoin:&lt;/code&gt;: This precedes your wallet’s public address, specifying the protocol to use when evaluating the QR content. It’s agreed upon that &lt;code class=&quot;highlighter-rouge&quot;&gt;bitcoin:&lt;/code&gt; opens / is handled by the user’s default wallet application (both on desktop and mobile).&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;3Qdb9iCMfzppCw4nME1Fst7Dsk7DmyuT4j&lt;/code&gt;: This is my wallet’s public bitcoin address. Replace it with your own (you can skip this step, but that would mean more money for me ;)…)&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;?label=pwntr.com%20says%20thanks!&lt;/code&gt;: You might’ve guessed it. This is a reference that you want this transaction to be known by. The &lt;code class=&quot;highlighter-rouge&quot;&gt;?&lt;/code&gt; is the delimiter for the query string’s attributes that follow, in this case, just &lt;code class=&quot;highlighter-rouge&quot;&gt;label&lt;/code&gt;. &lt;code class=&quot;highlighter-rouge&quot;&gt;%20&lt;/code&gt; is just a URI encoded space character, so that the message reads &lt;code class=&quot;highlighter-rouge&quot;&gt;pwntr.com says thanks!&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You could also add &lt;code class=&quot;highlighter-rouge&quot;&gt;amount&lt;/code&gt; in the string to specify a preset amount for the transaction. Only the first parameter in the query string after your public bitcoin address is delimited with a &lt;code class=&quot;highlighter-rouge&quot;&gt;?&lt;/code&gt;. All subsequent parameters are delimited by an ampersand (&lt;code class=&quot;highlighter-rouge&quot;&gt;&amp;amp;param&lt;/code&gt;). In case of &lt;code class=&quot;highlighter-rouge&quot;&gt;amount&lt;/code&gt;, this would look like this: &lt;code class=&quot;highlighter-rouge&quot;&gt;&amp;amp;amount=20&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Some param that is used and implemented less frequently is &lt;code class=&quot;highlighter-rouge&quot;&gt;message&lt;/code&gt;. Analogous to the &lt;code class=&quot;highlighter-rouge&quot;&gt;amount&lt;/code&gt; example from above, you could put it in with &lt;code class=&quot;highlighter-rouge&quot;&gt;&amp;amp;message=donation&lt;/code&gt;. In my experiments, this breaks some wallet clients as they don’t handle this extra param and hiccup.&lt;/p&gt;

&lt;p&gt;More params are discussed RFC-like on bitcoins gihub pages, like &lt;a href=&quot;https://github.com/bitcoin/bips/blob/master/bip-0021.mediawiki#Query_Keys&quot;&gt;this one&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;putting-it-all-together&quot;&gt;Putting it all together&lt;/h2&gt;

&lt;p&gt;Now that we know how to create QR codes and how to craft nifty query strings with bitcoin addresses, nothing is holding us back any longer. Type:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;qrencode &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; bitcoin-qr-example.png &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; 3 &lt;span class=&quot;nt&quot;&gt;-m&lt;/span&gt; 0 &lt;span class=&quot;s1&quot;&gt;'bitcoin:3Qdb9iCMfzppCw4nME1Fst7Dsk7DmyuT4j?label=pwntr.com%20says%20thanks!'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;You’ll get this:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2016/07/bitcoin-qr-example.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Once you scanned the code, the scanner will open your default wallet application, asking for the amount to donate (or to transfer, more generally speaking).&lt;/p&gt;

&lt;h2 id=&quot;a-simple-link-or-button-to-make-your-life-complete&quot;&gt;A simple link or button to make your life complete&lt;/h2&gt;

&lt;p&gt;Alright, we have the perfect QR code now. All that’s left is to insert it into our website or print it somewhere else. For the website case, just adding the image inside an anchor tag (&lt;code class=&quot;highlighter-rouge&quot;&gt;&amp;lt;a&amp;gt;&amp;lt;/a&amp;gt;&lt;/code&gt;) would already do the trick. As you can see, below every article I added a little bitcoin logo along the QR code we just created, inside said anchor tag.&lt;/p&gt;

&lt;h3 id=&quot;example&quot;&gt;Example&lt;/h3&gt;

&lt;p&gt;And here it is, just add something like this anywhere you’d like your donation button to appear. People can then either click or scan it, depending on which device their wallet resides. And for anyone who wants to read it off manually, you can have the public bitcoin address visible in plain sight:&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;bitcoin:3Qdb9iCMfzppCw4nME1Fst7Dsk7DmyuT4j?label=pwntr.com%20says%20thanks!&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;img&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;img/bitcoin_logo.png&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;img&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;img/bitcoin_qr.png&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;br&amp;gt;&amp;lt;span&amp;gt;&lt;/span&gt;3Qdb9iCMfzppCw4nME1Fst7Dsk7DmyuT4j&lt;span class=&quot;nt&quot;&gt;&amp;lt;/span&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Results in something you see below the articles on this blog. Neat.&lt;/p&gt;

&lt;h1 id=&quot;closing-thoughts&quot;&gt;Closing thoughts&lt;/h1&gt;

&lt;p&gt;That wasn’t too hard, was it? I hope you liked this little tutorial. If you have any questions, please leave a comment.&lt;/p&gt;

&lt;p&gt;In case you’d like to show your appreciation with some cold hard cash, go ahead, the public address in the logo above (and below this article) is live and awaiting any gracious donations :).&lt;/p&gt;</content><author><name></name></author><summary type="html">QR codes. Yes, those little rascals you’ve seen around before. Let’s create one to serve as a Bitcoin donation button for your website.</summary></entry><entry><title type="html">Microsoft Surface: why I might switch (update: didn’t switch)</title><link href="https://pwntr.com/2012/08/17/microsoft-surface-why-i-might-switch/" rel="alternate" type="text/html" title="Microsoft Surface: why I might switch (update: didn't switch)" /><published>2012-08-17T05:23:25+02:00</published><updated>2012-08-17T05:23:25+02:00</updated><id>https://pwntr.com/2012/08/17/microsoft-surface-why-i-might-switch</id><content type="html" xml:base="https://pwntr.com/2012/08/17/microsoft-surface-why-i-might-switch/">&lt;p&gt;Well, it turns out some people are actually reading my post about Time Machine backups. So let’s create some more content on this nice little blog.&lt;/p&gt;

&lt;p&gt;Today I finally watched the full Microsoft keynote about it’s new wunder-device, the Surface tablet PC and even found time to drop a comment or two. I really like the fact that it’s a real alternative to an actual PC since it’s more powerful than a regular tablet and it runs any x86 software you throw at it. What sold me in particular was the demo they used running Adobe Lightroom. On the hardware side the keyboard covers look very nice, the software itself seemed a bit buggy yet (finger swiping sometimes didn’t work, as well as the palm lock when using a stylus). At this early stage this is acceptable and no biggie, but only because Microsoft obviously found itself comfortable in its new role: being the underdog and copycat. Copying the magnet lock for the cover and some design aspects, they yet enriched the design with useful elements like the stand and paid great attention to detail. They stress that out in the video more than just once ;)…&lt;/p&gt;

&lt;!--more--&gt;

&lt;p&gt;Let’s take a look at the things I currently do with my beloved and portable MacBook Air (2011, core i7):&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;Surf the web&lt;/li&gt;
	&lt;li&gt;Read and write a ton of emails&lt;/li&gt;
	&lt;li&gt;Stay in contact with friends and family using Skype, facebook, ...&lt;/li&gt;
	&lt;li&gt;Edit photos while on road trips worldwide&lt;/li&gt;
	&lt;li&gt;Watch HD movies and TV series on the plane&lt;/li&gt;
	&lt;li&gt;Take notes during classes&lt;/li&gt;
	&lt;li&gt;Read PDFs and eBooks&lt;/li&gt;
	&lt;li&gt;Do some programming whenever necessary&lt;/li&gt;
	&lt;li&gt;Control my servers from wherever I am&lt;/li&gt;
	&lt;li&gt;Transfer files from and to friends and family&lt;/li&gt;
	&lt;li&gt;Support and debug on site&lt;/li&gt;
	&lt;li&gt;Do some work (see below)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;An iPad could do some these things, but not all or only too complicated to fiddle around with. Plus it’s expensive, limited on storage, has no USB ports to extend storage or functionality and is too slow to do real RAW photo editing on the go. It works great as a device to consume media and even produce it in a very limited way, but for some serious business you need more flexibility. And business will be what will drive sales for the Microsoft Surface. Imagine a day at work, for me it has to do with accessing the companies’ network (sometimes over a wired connection), handling and editing spreadsheets and word files, creating presentations and working on papers to solve or illustrate problems and processes. It would be impossible or at least very cumbersome to do most of these tasks on an iPad or any other other tablet available right now (including the Nexus 7 I was eyeballing lately).&lt;/p&gt;

&lt;p&gt;This is the perfect niche for a “new” device like the Surface. It aims at productivity and flexibility and is the first device that actually fulfills the proclaimed status of being in the post PC era. You can’t just drop everything you’ve been doing for the last decades and limit yourself to mostly consuming (at least not in most jobs and life situations). For me, post PC means a transition of handling regular PCs and creating new ways to interact with those devices, like through the use of touch screens and even a stylus for some situations. Steve jobs hated the idea of the stylus, and for most tasks it’s truly obsolete these days. But the classroom environment on campuses worldwide makes using one on a tablet a nice way to take notes in school books, papers or whatever. I can also see myself doodling on it during a presentation. It’s just intuitive like scribbling with a pen into your paper book, you don’t have to take that extra step of having to process how to add a note to whatever document you’re editing right now using a keyboard and a mouse. And it’s way more precise than your clunky finger tip.&lt;/p&gt;

&lt;p&gt;From a product perspective, Apple showed the world a couple of times that for some categories the sealed “we make the whole banana” process of product development and manufacturing, including hardware and software, just works best. For that reason I’m a faithful mac user for over 6 years now. You just open your MacBook and it works. Throughout the years I never had any really bad bugs or quirks that destroyed the work I was doing or did. Updates, hardware, software, no problem. The only thing I was missing was some real processing power on the graphics side. That’s why I opted in some months ago and built a small AMD and Nvidia workstation, powered by Windows 7. In combination with a SSD this setup is a blessing when it comes to photo editing and sorting.&lt;/p&gt;

&lt;p&gt;So, depending on the final price of the most powerful Surface tablet with x86 hardware, I might be adopting the Microsoft approach to mobile computing and buy it. That said, my MacBook Air will have to go then. And I’m not yet comfortable with that thought… Let’s see what the future brings.&lt;/p&gt;

&lt;p&gt;Don’t miss to check out the keynote:&lt;/p&gt;
&lt;iframe width=&quot;853&quot; height=&quot;480&quot; src=&quot;https://www.youtube-nocookie.com/embed/ervY6As5OcI&quot; frameborder=&quot;0&quot; allowfullscreen=&quot;&quot;&gt;&lt;/iframe&gt;</content><author><name></name></author><summary type="html">Well, it turns out some people are actually reading my post about Time Machine backups. So let’s create some more content on this nice little blog.</summary></entry><entry><title type="html">Easy Mac OS X (Mountain) Lion and Mavericks 10.7, 10.8 and 10.9 Time Machine backup using an Ubuntu Linux server [11.10, 12.04 LTS and up]</title><link href="https://pwntr.com/2012/03/03/easy-mac-os-x-lion-10-7-time-machine-backup-using-an-ubuntu-linux-server-11-10-12-04-lts-and-up/" rel="alternate" type="text/html" title="Easy Mac OS X (Mountain) Lion and Mavericks 10.7, 10.8 and 10.9 Time Machine backup using an Ubuntu Linux server [11.10, 12.04 LTS and up]" /><published>2012-03-03T22:50:47+01:00</published><updated>2012-03-03T22:50:47+01:00</updated><id>https://pwntr.com/2012/03/03/easy-mac-os-x-lion-10-7-time-machine-backup-using-an-ubuntu-linux-server-11-10-12-04-lts-and-up</id><content type="html" xml:base="https://pwntr.com/2012/03/03/easy-mac-os-x-lion-10-7-time-machine-backup-using-an-ubuntu-linux-server-11-10-12-04-lts-and-up/">&lt;p&gt;Maybe you always wanted to have an &lt;em&gt;Apple Time Capsule&lt;/em&gt; for easy backup management of your Macs. One of the drawbacks that comes with a device like that is its price. You could also use any Mac for it, but those are also expensive and most likely don’t wanna be hidden in a dusty closet. If you have an old PC somewhere that can run Linux (or BSD or any other UNIX) you already have everything you need to build a cheap, reliable &lt;em&gt;Time Capsule&lt;/em&gt; yourself. Let’s get started!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What you’ll need:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;A PC running Linux (or BSD etc.) as the server&lt;/li&gt;
  &lt;li&gt;A Mac (OS X 10.5 and above) that likes to use the Time Machine backup feature&lt;/li&gt;
  &lt;li&gt;A hard drive or spare disk space on your server that is at least as big as the Mac’s hard drive&lt;/li&gt;
  &lt;li&gt;A fast network to make things smooth&lt;/li&gt;
  &lt;li&gt;The latest version of &lt;a href=&quot;http://netatalk.sourceforge.net/&quot;&gt;Netatalk&lt;/a&gt; (&amp;gt;= v. 2.2.0)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This guide will use Ubuntu Linux as an example as I tested it with Ubuntu Linux 11.10 and 12.04 LTS. The only critical part is that your Netatalk version has to be &amp;gt;= 2.2.0 beta 4, else it won’t work with Lion. Aside from that pre-requisite you can use any Linux/UNIX/BSD/… distribution you want. On the client side, every version since Mac OS X Leopard (10.5) will work. And yes, that includes Lion, Mountain Lion and the newest Mavericks!&lt;/p&gt;

&lt;h2 id=&quot;step-0-optional-but-recommended&quot;&gt;[Step 0. Optional, but recommended]&lt;/h2&gt;
&lt;p&gt;If you are using Ubuntu 11.10 or earlier, add this ppa repository to easily install and update Netatalk to one of the most current versions:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;add-apt-repository ppa:jstrunk-math/ppa
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;If you tried to set up a Time Machine / Netatalk installation before and didn’t succeed, completely remove Netatalk and all of its configuration files before you proceed:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt-get remove &lt;span class=&quot;nt&quot;&gt;--purge&lt;/span&gt; netatalk
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;There is also no need for any additional Avahi setup since Netatalk 2.2.x comes with built-in Avahi/Bonjour/Zeroconf capabilities in case you were wondering.&lt;/p&gt;

&lt;h2 id=&quot;step-1-install-netatalk&quot;&gt;Step 1: Install Netatalk&lt;/h2&gt;
&lt;p&gt;Log in to your server by SSH or open up a shell on it locally. To install Netatalk, type:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt-get &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;netatalk
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Ok, first step: done!&lt;/p&gt;

&lt;h2 id=&quot;step-2-configure-the-afpd-server&quot;&gt;Step 2: Configure the afpd server&lt;/h2&gt;
&lt;p&gt;Edit &lt;code class=&quot;highlighter-rouge&quot;&gt;/etc/netatalk/afpd.conf&lt;/code&gt; with your favorite editor and add the following line at the end (comment out every other line that might be active):&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;- -tcp -noddp -uamlist uams_dhx.so,uams_dhx2_passwd.so -nosavepassword
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This will define the afpd server (Netatalk).&lt;/p&gt;

&lt;p&gt;Due to a &lt;a href=&quot;https://bugs.launchpad.net/ubuntu/+source/netatalk/+bug/810732&quot;&gt;bug in Ubuntu 11.10’s Netatalk version&lt;/a&gt; you have to use &lt;code class=&quot;highlighter-rouge&quot;&gt;uams_dhx2_passwd.so&lt;/code&gt; instead of the usual &lt;code class=&quot;highlighter-rouge&quot;&gt;uams_dhx2.so&lt;/code&gt; as the authentication module. If your are using Ubuntu 12.04 or later you can use either module (my reader Brandon mentioned that &lt;code class=&quot;highlighter-rouge&quot;&gt;uams_dhx2_passwd.so&lt;/code&gt; might still be needed in 12.10).&lt;/p&gt;

&lt;p&gt;Next make sure your &lt;code class=&quot;highlighter-rouge&quot;&gt;/etc/default/netatalk&lt;/code&gt; file shows &lt;code class=&quot;highlighter-rouge&quot;&gt;CNID_METAD_RUN=yes&lt;/code&gt;. This will ensure that all the metadata that is needed by OS X is handled and saved by an extra daemon on the side, too.&lt;/p&gt;

&lt;h2 id=&quot;step-3-create-and-prepare-the-time-machine-backup-locations&quot;&gt;Step 3: Create and prepare the Time Machine backup locations&lt;/h2&gt;
&lt;p&gt;First of all you should decide which directories you would like to share with your Macs and where you want to save your Time Machine backups. And which user on your server shall be in charge of which backup and directory etc. Here’s an example setup with one user called &lt;code class=&quot;highlighter-rouge&quot;&gt;username&lt;/code&gt; (how creative):&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; /home/username/
&lt;span class=&quot;nb&quot;&gt;mkdir &lt;/span&gt;tm_backup
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Creating the backup directory in his home directory ensures that he has the necessary rights to read and write in it. If you want to keep the backups somewhere else, say on an external hard drive, make sure that the user has the correct rights to access it fully! Here’s another example:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; /media/backup_hdd/
&lt;span class=&quot;nb&quot;&gt;sudo mkdir &lt;/span&gt;tm_backup
&lt;span class=&quot;nb&quot;&gt;sudo chown&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-R&lt;/span&gt; username:username tm_backup
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;If you want be really fancy and have a single directory for all backups of all your Macs and users, create a group for the Time Machine users:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;groupadd tmusers
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;usermod &lt;span class=&quot;nt&quot;&gt;-a&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-G&lt;/span&gt; tmusers username
&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; /media/backup_hdd/
&lt;span class=&quot;nb&quot;&gt;sudo mkdir &lt;/span&gt;tm_backup
&lt;span class=&quot;nb&quot;&gt;sudo chown&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-R&lt;/span&gt; username:tmusers tm_backup
&lt;span class=&quot;nb&quot;&gt;sudo chmod &lt;/span&gt;770 &lt;span class=&quot;nt&quot;&gt;-R&lt;/span&gt; tm_backup
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This will add a new group called &lt;code class=&quot;highlighter-rouge&quot;&gt;tmusers&lt;/code&gt; to your systems, add the existing user &lt;code class=&quot;highlighter-rouge&quot;&gt;username&lt;/code&gt; to it, create the backup directory and ensure that the owner &lt;code class=&quot;highlighter-rouge&quot;&gt;username&lt;/code&gt; and the group &lt;code class=&quot;highlighter-rouge&quot;&gt;tmusers&lt;/code&gt; have full access to it. However, it is also possible to skip this step and just use a single user on the server for all the Time Machine backups. Always keep in mind that the backups might be accessible by the other users if they’re all saved to a common directory. Creating a directory and a share for each user separately is the safest method.&lt;/p&gt;

&lt;h2 id=&quot;step-4-configure-the-shared-directory-in-netatalks-config&quot;&gt;Step 4: Configure the shared directory in Netatalk’s config&lt;/h2&gt;
&lt;p&gt;Now that we have the actual directory set up in the file system we can add the following line to the &lt;code class=&quot;highlighter-rouge&quot;&gt;/etc/netatalk/AppleVolumes.default&lt;/code&gt; file:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;/media/backup_hdd/tm_backup &quot;Backup for username&quot; allow:username cnidscheme:dbd volsizelimit:200000 options:usedots,upriv,tm
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Adjust the location of the directory and the username to your needs. The example above also limits the size shown to OS X as 200 GB (the number is given in MiB, so it’s 200,000 times 1024 in the real world). Also note that the &lt;code class=&quot;highlighter-rouge&quot;&gt;tm&lt;/code&gt; option is only option separating a Time Machine capable directory from a regular afp share.&lt;/p&gt;

&lt;p&gt;Add a line like this for every user and directory that is supposed to make Time Machine backups. If you want to allow a whole group of users to access a directory for the purpose of Time Machine backups, use this line and make sure to edit the &lt;code class=&quot;highlighter-rouge&quot;&gt;@tmusers&lt;/code&gt; option to be &lt;code class=&quot;highlighter-rouge&quot;&gt;@yourgroupname&lt;/code&gt; (notice the @ in front of the group name).&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;/media/backup_hdd/tm_backup &quot;Backup for all users&quot; allow:@tmusers cnidscheme:dbd volsizelimit:1000000 options:usedots,upriv,tm
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I made an adjustment to the &lt;code class=&quot;highlighter-rouge&quot;&gt;volsizelimit&lt;/code&gt; option since 200 GB might not be enough to backup multiple Macs.&lt;/p&gt;

&lt;p&gt;I also added the following line at the beginning of my &lt;code class=&quot;highlighter-rouge&quot;&gt;/etc/netatalk/AppleVolumes.default&lt;/code&gt; file:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;:DEFAULT: cnidscheme:dbd options:upriv,usedots
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This adds some useful default settings when handling more than just a backup share. Just fyi.&lt;/p&gt;

&lt;p&gt;Restart the Netatalk daemon to make sure it uses the newly adjusted configurations:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;service netatalk restart
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;We are now done configuring the server. Congratulations! Continue on the client side.&lt;/p&gt;

&lt;h2 id=&quot;step-5-configure-the-macs-to-use-the-server-as-a-time-machine-volume&quot;&gt;Step 5: Configure the Macs to use the server as a Time Machine volume&lt;/h2&gt;
&lt;p&gt;Open up a terminal on your &lt;strong&gt;Mac&lt;/strong&gt; (press &lt;code class=&quot;highlighter-rouge&quot;&gt;Command + Space&lt;/code&gt;, then enter &lt;code class=&quot;highlighter-rouge&quot;&gt;Terminal&lt;/code&gt; and hit &lt;code class=&quot;highlighter-rouge&quot;&gt;Enter&lt;/code&gt;) and allow unsupported network volumes to be used as a Time Machine backup destination:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Note: run this command as the user that is going to actually make the backup, don’t put &lt;code class=&quot;highlighter-rouge&quot;&gt;sudo&lt;/code&gt; in front of the command!&lt;/p&gt;

&lt;p&gt;That is all for the command line work. From here on we can use the Mac OS X GUI to continue setting up the Time Machine backup.&lt;/p&gt;

&lt;p&gt;Before you do anything else, restart your Mac. Trust me on that one, for some reason it didn’t work for me until I restarted my Mac. Save yourself some time and trouble.&lt;/p&gt;

&lt;p&gt;After a fresh boot open up Finder and press &lt;code class=&quot;highlighter-rouge&quot;&gt;Command + K&lt;/code&gt; to bring up the “Connect to Server” dialog.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2012/03/connect-to-server-dialog.png&quot; alt=&quot;Connect to server dialog&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Enter &lt;code class=&quot;highlighter-rouge&quot;&gt;afp://ip_address_of_your_server&lt;/code&gt;, press &lt;code class=&quot;highlighter-rouge&quot;&gt;Enter&lt;/code&gt; and select the according share from the list. Fill in username and password from the user on the server (not the one on the Mac) and see if you have access to the share. If everything works well, continue with the Time Machine preferences.&lt;/p&gt;

&lt;p&gt;In the system preferences on your Mac, select Time Machine and click on “Select Disk…”&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2012/03/time-machine-list-of-shares.png&quot; alt=&quot;Time Machine list of shares&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Select your share from the list, edit the other options like excluded directories and automatic backups to your liking and enjoy this cheap and reliable Time Machine solution! The first backup might take quite some time, depending on your network and hard drive speed. All the following backups will be incremental and a lot faster.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Bonus&lt;/strong&gt;: you don’t even have to manually connect to the server share before a backup. Time Machine will let its magic happen and auto-mount / un-mount the share whenever it is needed. Peace of mind in a box.&lt;/p&gt;

&lt;p&gt;P.S.: You can even use this share and setup to easily restore your Mac from scratch after it has crashed or caught fire.&lt;/p&gt;

&lt;p&gt;Here are some useful in-depth links for further reading:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://netatalk.sourceforge.net/2.2/htmldocs/afpd.conf.5.html&quot;&gt;afpd.conf manpage&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://netatalk.sourceforge.net/2.2/htmldocs/AppleVolumes.default.5.html&quot;&gt;AppleVolumes.default manpage&lt;/a&gt;&lt;/p&gt;</content><author><name></name></author><summary type="html">Maybe you always wanted to have an Apple Time Capsule for easy backup management of your Macs. One of the drawbacks that comes with a device like that is its price. You could also use any Mac for it, but those are also expensive and most likely don’t wanna be hidden in a dusty closet. If you have an old PC somewhere that can run Linux (or BSD or any other UNIX) you already have everything you need to build a cheap, reliable Time Capsule yourself. Let’s get started!</summary></entry><entry><title type="html">Hello world!</title><link href="https://pwntr.com/2011/12/26/hello-world/" rel="alternate" type="text/html" title="Hello world!" /><published>2011-12-26T08:43:53+01:00</published><updated>2011-12-26T08:43:53+01:00</updated><id>https://pwntr.com/2011/12/26/hello-world</id><content type="html" xml:base="https://pwntr.com/2011/12/26/hello-world/">&lt;p&gt;Welcome to my nice little website! I hope you enjoy my tutorials and random thoughts. Please feel free to leave a comment if you have any questions. I’ll be glad to help.&lt;/p&gt;</content><author><name></name></author><summary type="html">Welcome to my nice little website! I hope you enjoy my tutorials and random thoughts. Please feel free to leave a comment if you have any questions. I’ll be glad to help.</summary></entry></feed>