<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:series="http://organizeseries.com/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Arabesque</title>
	
	<link>http://blog.sanctum.geek.nz</link>
	<description>Systems, Tools, and Terminal Science</description>
	<lastBuildDate>Sun, 07 Apr 2013 14:36:11 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/arabesqueblog" /><feedburner:info uri="arabesqueblog" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Linux Crypto – GnuPG Usage</title>
		<link>http://feedproxy.google.com/~r/arabesqueblog/~3/PbWYZmgnxa8/</link>
		<comments>http://blog.sanctum.geek.nz/linux-crypto-gnupg-usage/#comments</comments>
		<pubDate>Sun, 31 Mar 2013 03:42:34 +0000</pubDate>
		<dc:creator>Tom Ryder</dc:creator>
				<category><![CDATA[Cryptography]]></category>
		<category><![CDATA[crypto]]></category>
		<category><![CDATA[gnupg]]></category>
		<category><![CDATA[gpg]]></category>
		<category><![CDATA[gpg-agent]]></category>
		<category><![CDATA[keychain]]></category>
		<category><![CDATA[keys]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[pass]]></category>
		<category><![CDATA[password manager]]></category>
		<category><![CDATA[passwords]]></category>
		<category><![CDATA[rsa]]></category>
		<category><![CDATA[ssh-agent]]></category>

		<guid isPermaLink="false">http://blog.sanctum.geek.nz/?p=1205</guid>
		<description><![CDATA[With our private and public key generated and stored, we can start using a few of GnuPG&#8217;s features to sign, verify, encrypt, and decrypt files and messages for distribution over untrusted channels like the internet. Signing a message or text &#8230; <a href="http://blog.sanctum.geek.nz/linux-crypto-gnupg-usage/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>With our private and public key generated and stored, we can start using a few
of GnuPG&#8217;s features to sign, verify, encrypt, and decrypt files and messages
for distribution over untrusted channels like the internet.</p>

<h2>Signing a message or text file</h2>

<p>We&#8217;ll start by signing a simple text file, using the <code>--clearsign</code> option. This
includes the signature in the message, which we can then distribute to people
to read. Here&#8217;s the contents of <code>message.txt</code>:</p>

<pre><code>This is a public message from Tom Ryder.
</code></pre>

<p>We&#8217;ll sign that with our new private key like so:</p>

<pre><code>$ gpg --clearsign message.txt
</code></pre>

<p>We&#8217;re prompted for our passphrase for the private key:</p>

<pre><code>You need a passphrase to unlock the secret key for
user: "Tom Ryder (Test Key Only) &lt;tom@sanctum.geek.nz&gt;"
4096-bit RSA key, ID 040FE79B, created 2013-03-23
</code></pre>

<p>Having provided that, the file <code>message.txt.asc</code> is created, with PGP sections
and a plaintext ASCII signature:</p>

<pre><code>-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

This is a public message from Tom Ryder.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iQIcBAEBCAAGBQJRTQcTAAoJEGIHQ4oED+ebtjoP/19PlndkGhR46BA6YZmDVdC1
Snk9aXe4Eo42kRpW13bjo8xg+pb+U26ylHkH52OBB7fJ3/BR5eZMug/RXJLGIf+U
aiylbGVz4dGjkeTCSxtg1TvcyEtzhm1ETfIWLarboj9PPBJfO1QIh4uPDkD7kb6+
+OnpdxPURbiJ03osu2Mj2fFq5wYT0La+I9BdKUAJmS8zt+CaTirKw+xF6l0sEAVv
lqslWjEwF9JCfumKAj8aMBeZMndoKRqW18ZHoYJdP0x3g1SUKAjZ/NRRUGug6Eg+
JTJ82ETCRKGKmYFLkHJ6iCaucrmhLTd9IYyEQZE/weUuClKqtshollhNHF1dD3SF
fWMPq0+29DInjlXwIkXyzVDln1wULNzbd5zv5Wg5b6lSCZlwH0xCrNjiYO7f413c
Ty4q6SqtRFUommnpMA5XcmX7ebbUpMfqfqqzoLqeTpA15Yuhh3DDR6NoMN82oLyF
FFt7UZh/JlYMc8GOnEqyZfT7d57FbKSLn3vpZbH9QXNFWG6/oZabFFyRm8r7k8F2
FzYTdyp59O0dW4T5OJ6a/xo/OnZutUN1RqW6ZJS19Xb4/5eEohFAFL9cDVLuC6zo
HmlA2m5zwv8aYbJad6Rk6+vpQAAdxHgNq/VYdcOfLOtcJAE6Jnm3alVyeXb1PbMB
WBxaM998Z6R8VmeMB7gQ
=WMzO
-----END PGP SIGNATURE-----
</code></pre>

<p>Note that the message itself is plainly readable; this message isn&#8217;t encrypted,
it&#8217;s just verified as having been written by a particular person, and not
altered since it was written.</p>

<p>Now anyone who has our public key on their keyring (as we ourselves do) can
verify that it was actually us who wrote this message:</p>

<pre><code>$ gpg --verify message.txt.asc
gpg: Signature made Sat 23 Mar 2013 14:32:17 NZDT using RSA key ID 040FE79B
gpg: Good signature from "Tom Ryder (Test Key Only) &lt;tom@sanctum.geek.nz&gt;"
</code></pre>

<p>If anybody tampers with the message, even something like removing a period from
the end of a sentence, the verification will fail, suggesting the message was
tampered with:</p>

<pre><code>$ gpg --verify message.txt.asc
gpg: Signature made Sat 23 Mar 2013 14:32:17 NZDT using RSA key ID 040FE79B
gpg: BAD signature from "Tom Ryder (Test Key Only) &lt;tom@sanctum.geek.nz&gt;"
</code></pre>

<h2>Signing and verifying binary files</h2>

<p>For all other files, we likely need to make the signature file separate with
a <strong>detached signature</strong>:</p>

<pre><code>$ gpg --armor --detach-sign archive.tar.gz
</code></pre>

<p>This produces a file <code>archive.tar.gz.asc</code> in the same directory, containing the
signature. We use <code>--armor</code> to make the signature in ASCII, which makes for
a longer file but easier distribution online.</p>

<p>In this case, both the file and the signature are required for verification;
put the signature file first when you check this:</p>

<pre><code>$ gpg --verify archive.tar.gz.asc archive.tar.gz
</code></pre>

<p>You can use this method to verify software downloads from trusted sources, such
as the <a href="http://httpd.apache.org/dev/verification.html">Apache HTTPD development team</a>. First, we would download and
import all their public keys at the URL they nominate:</p>

<pre><code>$ wget http://www.apache.org/dist/httpd/KEYS
$ gpg --import KEYS
</code></pre>

<p>We could then download an Apache HTTPD release, along with its key, from an
arbitrary mirror:</p>

<pre><code>$ wget http://www.example.com/apache/httpd/httpd-2.4.4.tar.gz
$ wget http://www.apache.org/dist/httpd/httpd-2.4.4.tar.gz.asc
</code></pre>

<p>We can then use the key and signature to verify that it&#8217;s an uncompromised copy
of the original file signed by the developers:</p>

<pre><code>$ gpg --verify httpd-2.4.4.tar.gz.asc httpd-2.4.4.tar.gz
gpg: Signature made Tue 19 Feb 2013 09:28:39 NZDT using RSA key ID 791485A8
gpg: Good signature from "Jim Jagielski (Release Signing Key) &lt;jim@apache.org&gt;"
gpg:                 aka "Jim Jagielski &lt;jim@jaguNET.com&gt;"
gpg:                 aka "Jim Jagielski &lt;jim@jimjag.com&gt;"
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: A93D 62EC C3C8 EA12 DB22  0EC9 34EA 76E6 7914 85A8
</code></pre>

<p>Note that the <code>gpg</code> output cautions that this is still not perfect assurance
that the release actually came from Jim Jagielski, because we&#8217;ve never met him
and can&#8217;t absolutely, definitely say that this is his public key. <a href="http://keyserver.ubuntu.com:11371/pks/lookup?op=vindex&amp;search=Jim+Jagielski&amp;fingerprint=on">Looking him
up on public keyservers</a>, we can however see a lot of other Apache
developers have signed his key, which looks promising, but do we know who <em>they</em>
are?</p>

<p>Despite the lack of absolute certainty, when downloading from mirrors this is
a lot better (and harder to exploit) than simply downloading without validating
or checksumming at all, given that the signature and the <code>KEYS</code> file were
downloaded from Apache&#8217;s own site.</p>

<p>You will need to decide for yourself <a href="http://www.gnupg.org/gph/en/manual.html#AEN335">how sure you need to be</a> whether
a person&#8217;s public key really corresponds to them. This might extend to the
point of arranging to meet them with government-issued identification!</p>

<h2>Encrypting a file</h2>

<p>We can encrypt a file so that only nominated people can decrypt and read it. In
this case, we encrypt it not with our own private key, but with the recipient&#8217;s
public key. This means that they will be able to decrypt it using their own
private key.</p>

<p>Here&#8217;s the contents of <code>secret-message.txt</code>:</p>

<pre><code>This is a secret message from Tom Ryder.
</code></pre>

<p>Now we need at least one recipient. Let&#8217;s say this message was intended for my
friend John Public. He&#8217;s given me his public key in a file called
<code>john-public.asc</code> on a USB drive in person; he even brought along his birth
certificate and driver&#8217;s license (which is weird, because I&#8217;ve known him since
I was four).</p>

<p>To start with, I&#8217;ll import his key into my keychain:</p>

<pre><code>$ gpg --import john-public.asc
gpg: key 695195A5: public key "John Public (Main key) &lt;johnpublic@example.com&gt;" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
</code></pre>

<p>Now I can encrypt the message for only John to read. I like to use the 8-digit
hex code for the key for <code>--recipient</code>, to make sure I&#8217;ve got the right person.
You can see it in the output above, or in the output of <code>gpg --list-keys</code>.</p>

<pre><code>$ gpg --armor --recipient 695195A5 --encrypt secret-message.txt
</code></pre>

<p>The encrypted message is written to <code>secret-message.txt.asc</code>:</p>

<pre><code>-----BEGIN PGP MESSAGE-----
Version: GnuPG v1.4.10 (GNU/Linux)

hQEMAxiBb8eWSupuAQgAgOUQvqbTh60N6RQhDtP/bY9l+gjm4Grx5XcuhgQqK6pn
YtyPTKcpHdPK679lhbv0vE0RYe7pL+nBOngU1hCQYuGbRDZDxIXTIZW/rBvXbtHA
jgeSxrquad2totfh2nc7upePVCqXncPrLraJyDJBLLMrBHVvmOZymDabJbemOFuq
A/NbcmT3+osptvaEPFdlbgAW+J3vGxXMuQQYkT8GSnuutfEhZRb7SEL1ktaXwaMc
AA6NAan5ak7nCyDDHhDSDFMS9SQQHd8TDvQPF6OzRXlq26EOFD8HvlbDcgc51lbS
+N5nWaHM/CiuPh9dIOEV0H4Y8WDBdgkxp6kXKQfqb9JzAdwQ047r82SJAA7MSqCS
HRVtCRf5SNM12HqTRzF9XXum4uG+HXT6Bpy+K/lYpLgmHcHoUVKh8c2OcGaCHWQh
UC9B+aaThKdkxUfD/9tVIRmugjutgj7KdtDTGm+qLeCoJqp6HK5z5SX8Ha+P6/P5
hxinyw==
=kqUG
-----END PGP MESSAGE-----
</code></pre>

<p>Note that even I can&#8217;t read it, because I didn&#8217;t list myself as a recipient,
and I don&#8217;t have access to John&#8217;s private key:</p>

<pre><code>tom@tombox:~$ gpg --decrypt secret-message.txt.asc
gpg: encrypted with 2048-bit RSA key, ID 964AEA6E, created 2013-03-10
    "John Public (Main key) &lt;johnpublic@example.com&gt;"
gpg: decryption failed: secret key not available
</code></pre>

<p>However, on John&#8217;s computer, using his private key, he can decrypt and read it:</p>

<pre><code>john@johnbox:~$ gpg --decrypt secret-message.txt.asc
gpg: encrypted with 2048-bit RSA key, ID 964AEA6E, created 2013-03-10
    "John Public (Main key) &lt;johnpublic@example.com&gt;"
This is a private, secret message from Tom Ryder.
</code></pre>

<p>If I wanted to make sure I could read the message too, I&#8217;d add my own public
key to identify myself as a recipient when I encrypt it. Then either of us will
be able to read it with our private keys (independently of the other):</p>

<pre><code>$ gpg --recipient 695195A5 --recipient 040FE79B \
    --armor --encrypt secret-message.txt
</code></pre>

<p>Just to be thorough, we can sign the message as well to prove it came from us:</p>

<pre><code>$ gpg --recipient 695195A5 --recipient 040FE79B \
    --armor --sign --encrypt secret-message.txt
</code></pre>

<p>Then when John runs the <code>--decrypt</code>, <code>gpg</code> will automatically verify the
signature for us too, provided he has my public key in his keyring:</p>

<pre><code>$ gpg --decrypt secret-message.txt.asc
gpg: encrypted with 2048-bit RSA key, ID 964AEA6E, created 2013-03-10
    "John Public (Main key) &lt;johnpublic@example.com&gt;"
gpg: encrypted with 4096-bit RSA key, ID AA159E5B, created 2013-03-23
    "Tom Ryder (Test Key Only) &lt;tom@sanctum.geek.nz&gt;"
This is a private, secret message from Tom Ryder.
gpg: Signature made Sat 23 Mar 2013 17:23:20 NZDT using RSA key ID 040FE79B
gpg: Good signature from "Tom Ryder (Test Key Only) &lt;tom@sanctum.geek.nz&gt;"
</code></pre>

<p>These are all the basic functions of GnuPG that will be useful to most people.
We haven&#8217;t considered here <a href="http://www.gnupg.org/gph/en/manual.html#AEN464">submitting keys to public servers</a>, or
participating in the <a href="http://en.wikipedia.org/wiki/Web_of_trust">web of trust</a>; you should only look into this once
you&#8217;re happy with how your key setup is working, and are ready to publish your
key for public use.</p>
<div class="seriesmeta">This entry is part 3 of 3 in the series <a href="http://blog.sanctum.geek.nz/series/linux-crypto/" class="series-454" title="Linux Crypto">Linux Crypto</a>.</div><img src="http://feeds.feedburner.com/~r/arabesqueblog/~4/PbWYZmgnxa8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.sanctum.geek.nz/linux-crypto-gnupg-usage/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
	
		<series:name><![CDATA[Linux Crypto]]></series:name>
	<feedburner:origLink>http://blog.sanctum.geek.nz/linux-crypto-gnupg-usage/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=linux-crypto-gnupg-usage</feedburner:origLink></item>
		<item>
		<title>Linux Crypto – GnuPG Keys</title>
		<link>http://feedproxy.google.com/~r/arabesqueblog/~3/K58TJKq-s2Q/</link>
		<comments>http://blog.sanctum.geek.nz/linux-crypto-gnupg-keys/#comments</comments>
		<pubDate>Sun, 31 Mar 2013 03:40:43 +0000</pubDate>
		<dc:creator>Tom Ryder</dc:creator>
				<category><![CDATA[Cryptography]]></category>
		<category><![CDATA[crypto]]></category>
		<category><![CDATA[gnupg]]></category>
		<category><![CDATA[gpg]]></category>
		<category><![CDATA[gpg-agent]]></category>
		<category><![CDATA[keychain]]></category>
		<category><![CDATA[keys]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[pass]]></category>
		<category><![CDATA[password manager]]></category>
		<category><![CDATA[passwords]]></category>
		<category><![CDATA[rsa]]></category>
		<category><![CDATA[ssh-agent]]></category>

		<guid isPermaLink="false">http://blog.sanctum.geek.nz/?p=1201</guid>
		<description><![CDATA[Many tools that use cryptography on Linux and the internet revolve around the Pretty Good Privacy software standard (OpenPGP). The GNU Privacy Guard (GnuPG or GPG) is a popular free software implementation of this standard. You can install GnuPG with &#8230; <a href="http://blog.sanctum.geek.nz/linux-crypto-gnupg-keys/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Many tools that use cryptography on Linux and the internet revolve around the
<a href="http://en.wikipedia.org/wiki/Pretty_Good_Privacy">Pretty Good Privacy</a> software standard (OpenPGP). The GNU Privacy Guard
(GnuPG or GPG) is a popular free software implementation of this standard.</p>

<p>You can install GnuPG with its <code>gpg(1)</code> frontend on Debian like so:</p>

<pre><code># apt-get install gnupg
</code></pre>

<p>You can do a lot of very cool things with GPG, but it boils down to four
central ideas:</p>

<ul>
<li>Generation of <strong>keypairs</strong>, randomly-generated and mathematically linked
pairs of files, one of which is kept permanently secret (the <strong>private
key</strong>) and one of which is published (the <strong>public key</strong>). This is the
basis of <strong>asymmetric key cryptography</strong>.</li>
<li><strong>Managing</strong> keys, both your own public and private key, along with other
people&#8217;s public keys, so that you can verify others&#8217; messages and files, or
encrypt them so that only those people can read them. This might include
publishing your public key to online keyservers, and getting people to sign
it to confirm that the key is really yours.</li>
<li><strong>Signing</strong> files and messages with your private key to enable others to
verify that a file or message was authored or sighted by you, and not
edited in transmission over untrusted channels like the internet. The
message itself remains readable to everybody.</li>
<li><strong>Encrypting</strong> files and messages with other people&#8217;s public keys, so that
only those people can decrypt and read them with their private keys. You
can also sign such messages with your own private key so that people can
verify that it was sent by you.</li>
</ul>

<p>We&#8217;ll run through the fundamentals of each of these. We won&#8217;t concern ourselves
too much with the mathematics or algorithms behind these operations; the
Wikipedia article for <a href="http://en.wikipedia.org/wiki/Public-key_cryptography">asymmetric key cryptography</a> explains this very
well for those curious for further details.</p>

<h2>Generating a keypair</h2>

<p>Let&#8217;s start by generating a 4096-bit RSA keypair, which should be more than
sufficient for almost everyone at the time of writing. We&#8217;ll observe a few of
the <a href="http://keyring.debian.org/creating-key.html">best practices</a> recommended for the Debian developers.</p>

<p>Doing this on a private, up-to-date desktop machine is best, as it&#8217;s easier to
generate entropy this way. It&#8217;s still possible on an SSH-only headless server,
but you may have to resort to less cryptographically sound methods to generate
proper randomness.</p>

<p>Create or edit the file <code>~/.gnupg/gpg.conf</code> on your system, and add the
following lines:</p>

<pre><code>personal-digest-preferences SHA256
cert-digest-algo SHA256
default-preference-list SHA512 SHA384 SHA256 SHA224 AES256 AES192 AES CAST5 ZLIB BZIP2 ZIP Uncompressed
</code></pre>

<p>These lines tell GnuPG to use the cryptographically stronger SHA256 hashing
algorithm for signatures in preference to the <a href="http://www.schneier.com/blog/archives/2005/02/cryptanalysis_o.html">long-broken SHA1
algorithm</a>.</p>

<p>With that done, we can get down to generating some keys:</p>

<pre><code>$ gpg --gen-key
</code></pre>

<p>You will be prompted to choose the type of keypair you want. The default ought
to be <code>RSA and RSA</code>, which means we&#8217;ll generate one master key for signing, and
one <strong>subkey</strong> for encryption:</p>

<pre><code>Please select what kind of key you want:
   (1) RSA and RSA (default)
   (2) DSA and Elgamal
   (3) DSA (sign only)
   (4) RSA (sign only)
Your selection? 1
</code></pre>

<p>For the key length, choose the maximum 4096 bit RSA:</p>

<pre><code>What keysize do you want? (2048) 4096
Requested keysize is 4096 bits
</code></pre>

<p>The expiry date is up to you; if you&#8217;re just tinkering with GnuPG for the
moment, you should feel free to set a short expiry. However, if you&#8217;re in it
for the long haul and you&#8217;re confident you can keep your key secure
indefinitely, feel free to set it to never expire, as I&#8217;ll do here:</p>

<pre><code>Please specify how long the key should be valid.
       0 = key does not expire
    &lt;n&gt;  = key expires in n days
    &lt;n&gt;w = key expires in n weeks
    &lt;n&gt;m = key expires in n months
    &lt;n&gt;y = key expires in n years
Key is valid for? (0) 0
Key does not expire at all
Is this correct? (y/N) y
</code></pre>

<p>Next, we&#8217;re prompted for some basic information to name the key. In almost all
circumstances you should use your real name, as without a real-world means to
actually verify your identity, public keys are much less useful long-term. For
the comment, you can include the key&#8217;s purpose, or your public aliases, or any
other information relevant to the key:</p>

<pre><code>Real name: Tom Ryder
Email address: tom@sanctum.geek.nz
Comment: Test Key Only
You selected this USER-ID:
    "Tom Ryder (Test Key Only) &lt;tom@sanctum.geek.nz&gt;"

Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? O
</code></pre>

<h2>Key passphrase</h2>

<p>Next, we&#8217;re prompted for a passphrase to encrypt the key, so that if it ever
falls into the wrong hands, nobody will be able to use it without knowing the
passphrase.</p>

<pre><code>You need a Passphrase to protect your secret key.
</code></pre>

<p>Choose a sequence of random words, or possibly a unique sentence <a href="http://xkcd.com/936/">you can
easily memorise</a> in any language, the longer the better. Don&#8217;t choose
anything that might be feasibly guessable, like proverbs or movie quotes. You
will also need to remember how you typed the passphrase exactly; I recommend
using all-lowercase and no punctuation. Wikipedia has <a href="http://en.wikipedia.org/wiki/Passphrase#Passphrase_selection">a few guidelines
here</a>.</p>

<p>You&#8217;ll need to type the passphrase twice to confirm it, and it won&#8217;t echo on
your terminal, much as if you were typing a password.</p>

<h2>Entropy generation</h2>

<p>Finally, the system will prompt us to generate some entropy:</p>

<pre><code>We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.

Not enough random bytes available.  Please do some other work to give
the OS a chance to collect more entropy! (Need 283 more bytes)
</code></pre>

<p>This step is necessary for the computer to generate sufficient random
information to ensure that the private key being generated could not feasibly
be reproduced. Moving the mouse around and using the keyboard on a desktop
system is ideal, but generating any kind of hardware activity (including
spinning disks up) should do the trick. Running expensive <code>find(1)</code> operations
over a filesystem (with contents that couldn&#8217;t be reasonably predicted or
guessed) helps too.</p>

<p>This step benefits from patience. You might find discussion online about
forcing the use of the non-blocking PRNG random device <code>/dev/urandom</code> instead,
using a tool like <code>rngd(1)</code>. This definitely speeds up the process, but if
you&#8217;re going to be using your key for anything serious, I recommend actually
interacting with the computer and using hardware noise to seed the randomness
adequately, if you can.</p>

<p>When adequate entropy is read and the key generation is done, you&#8217;ll be
presented with some details for your master key and its signing subkey, and the
private and public keys for each are automatically added to your keyring for
use:</p>

<pre><code>gpg: /home/tom/.gnupg/trustdb.gpg: trustdb created
gpg: key 040FE79B marked as ultimately trusted
public and secret key created and signed.
gpg: checking the trustdb
gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
gpg: depth: 0  valid:   1  signed:   0  trust: 0-, 0q, 0n, 0m, 0f, 1u
pub   4096R/040FE79B 2013-03-23
    Key fingerprint = 7A28 5ADA 7680 6813 48DF  401B 6207 438A 040F E79B
uid                  Tom Ryder (Test Key Only) &lt;tom@sanctum.geek.nz&gt;
sub   4096R/AA159E5B 2013-03-23
</code></pre>

<h2>Managing keys</h2>

<p>With this done, we have our own keys added to the private and public keychain:</p>

<pre><code>$ gpg --list-secret-keys
/home/tom/.gnupg/secring.gpg
----------------------------
sec   4096R/040FE79B 2013-03-23
uid                  Tom Ryder (Test Key Only) &lt;tom@sanctum.geek.nz&gt;
ssb   4096R/AA159E5B 2013-03-23

$ gpg --list-public-keys
/home/tom/.gnupg/pubring.gpg
----------------------------
pub   4096R/040FE79B 2013-03-23
uid                  Tom Ryder (Test Key Only) &lt;tom@sanctum.geek.nz&gt;
sub   4096R/AA159E5B 2013-03-23
</code></pre>

<p>The directory <code>~/.gnupg</code> contains the managed keys. It&#8217;s very, very important
to keep this directory private and to back it up securely, preferably to
removable media that you keep in some physically secure place. Don&#8217;t lose it!</p>

<p>In most contexts in GnuPG, you can refer to a key by the name of its owner, or
by its eight-digit hex ID. I prefer the latter method. Here, the short ID of my
main key is <code>040FE79B</code>. While you shouldn&#8217;t use this for any actual
verification, it&#8217;s sufficiently unique that you can use it to identify
a specific key on your keyring with which you want to work.</p>

<p>For example, if we want to provide someone with a copy of our public key,
a friendly way to do so is to export it in ASCII format with <code>--armor</code>,
providing the appropriate key&#8217;s short ID:</p>

<pre><code>$ gpg --armor --export 040FE79B &gt; tom-ryder.public.asc
</code></pre>

<p>While you can export private keys the same way with <code>--export-secret-key</code>, you
should never, ever provide anyone with your private key, so this shouldn&#8217;t be
necessary.</p>

<h2>Revocation certificate</h2>

<p>After generating your keys, you should generate a <strong>revocation certificate</strong>:</p>

<pre><code>$ gpg --output revoke.asc --gen-revoke 040FE79B

sec  4096R/040FE79B 2013-03-23 Tom Ryder (Test Key Only) &lt;tom@sanctum.geek.nz&gt;

Create a revocation certificate for this key? (y/N) y
Please select the reason for the revocation:
0 = No reason specified
1 = Key has been compromised
2 = Key is superseded
3 = Key is no longer used
Q = Cancel
(Probably you want to select 1 here)
Your decision? 1
Enter an optional description; end it with an empty line:
&gt;
Reason for revocation: Key has been compromised
(No description given)
Is this okay? (y/N) y

You need a passphrase to unlock the secret key for
user: "Tom Ryder (Test Key Only) &lt;tom@sanctum.geek.nz&gt;"
4096-bit RSA key, ID 040FE79B, created 2013-03-23

ASCII armored output forced.
Revocation certificate created.

Please move it to a medium which you can hide away; if Mallory gets
access to this certificate he can use it to make your key unusable.
It is smart to print this certificate and store it away, just in case
your media become unreadable.  But have some caution:  The print system of
your machine might store the data and make it available to others!
</code></pre>

<p>You should store the resulting <code>revoke.asc</code> file somewhere safe. You can use
this certificate to <a href="http://www.gnupg.org/gph/en/manual.html#AEN305">revoke your key</a> later on if the private key is ever
compromised, so that people know the key should no longer be used or trusted.
You may even like to print it out and keep a hard copy, as the output of <code>gpg</code>
suggests.</p>

<p>With the above setup done, we can proceed with some basic usage of GnuPG, as
discussed in the next article.</p>

<h2>Subkeys</h2>

<p>In the output of both commands, you&#8217;ll note we actually have two private and
two public keys. The <code>sub</code> line refers to the <strong>encryption subkey</strong>
automatically generated for you. The master key is used for cryptographic
signing, and the subkey for encryption; this is how GnuPG does things by
default with RSA keypairs.</p>

<p>For extra security, it might be appropriate to physically remove the master
private key from your computer, and instead use a second generated subkey for
signing files as well. This is desirable because it allows you to keep the
master key secure on some removable media (preferably with a backup), and not
loaded on your main computer in case you get compromised.</p>

<p>This means you can sign and encrypt files as normal with your signing subkey
and encryption subkey. If those keys ever get compromised, you can simply
revoke them and generate new ones with your uncompromised master key; everyone
who has signed your public master key or otherwise indicated they trust it will
not have to do that all over again.</p>

<p>For details on how to do this, I suggest reading the <a href="http://wiki.debian.org/subkeys">Debian Wiki article on
subkey management</a>. However, it&#8217;s not necessary for performing basic GPG
operations.</p>
<div class="seriesmeta">This entry is part 2 of 3 in the series <a href="http://blog.sanctum.geek.nz/series/linux-crypto/" class="series-454" title="Linux Crypto">Linux Crypto</a>.</div><img src="http://feeds.feedburner.com/~r/arabesqueblog/~4/K58TJKq-s2Q" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.sanctum.geek.nz/linux-crypto-gnupg-keys/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<series:name><![CDATA[Linux Crypto]]></series:name>
	<feedburner:origLink>http://blog.sanctum.geek.nz/linux-crypto-gnupg-keys/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=linux-crypto-gnupg-keys</feedburner:origLink></item>
		<item>
		<title>Linux Crypto – Introduction</title>
		<link>http://feedproxy.google.com/~r/arabesqueblog/~3/m71ZiJklKHA/</link>
		<comments>http://blog.sanctum.geek.nz/linux-crypto-introduction/#comments</comments>
		<pubDate>Sun, 31 Mar 2013 03:18:39 +0000</pubDate>
		<dc:creator>Tom Ryder</dc:creator>
				<category><![CDATA[Cryptography]]></category>
		<category><![CDATA[crypto]]></category>
		<category><![CDATA[gnupg]]></category>
		<category><![CDATA[gpg]]></category>
		<category><![CDATA[gpg-agent]]></category>
		<category><![CDATA[keychain]]></category>
		<category><![CDATA[keys]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[pass]]></category>
		<category><![CDATA[password manager]]></category>
		<category><![CDATA[passwords]]></category>
		<category><![CDATA[rsa]]></category>
		<category><![CDATA[ssh-agent]]></category>

		<guid isPermaLink="false">http://blog.sanctum.geek.nz/?p=1197</guid>
		<description><![CDATA[Cryptography for authentication and encryption is a complex and frequently changing field, and for somebody new to using it, it can be hard to know where to start. If you&#8217;re a Linux user comfortable with the terminal, but unfamiliar with &#8230; <a href="http://blog.sanctum.geek.nz/linux-crypto-introduction/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Cryptography for authentication and encryption is a complex and frequently
changing field, and for somebody new to using it, it can be hard to know where
to start. If you&#8217;re a Linux user comfortable with the terminal, but unfamiliar
with the cryptographic tools available to you on open source UNIX-like
operating systems, this series of posts aims at getting you set up with some
basic tools that will allow you to keep your own information secure, to
authenticate conveniently and safely with remote servers, and to work with
signed and encrypted files online.</p>

<p>I&#8217;ll be working on Debian GNU/Linux, but most of these tools should adapt well
to other open source UNIX-likes, including BSD. Please feel free to comment on
the articles with details relevant to your own implementations, or with extra
security considerations for interested readers.</p>

<p>As a disclaimer, I&#8217;m not myself an expert on cryptographic algorithms or key
security. If you are, and you find an error or security problem with any of my
explanations or suggestions, please let me know and I will correct it and
credit you.</p>

<p>I&#8217;ll be covering the following topics:</p>

<ul>
<li><a href="http://blog.sanctum.geek.nz/linux-crypto-gnupg-keys/">GnuPG key generation and management</a></li>
<li><a href="http://blog.sanctum.geek.nz/linux-crypto-gnupg-usage/">GnuPG signing, verifying, encryption, and decryption</a></li>
<li>SSH key generation and authentication</li>
<li><code>gpg-agent(1)</code>, <code>ssh-agent(1)</code>, and the use of <code>keychain(1)</code></li>
<li>The <code>pass(1)</code> UNIX password manager</li>
</ul>

<p>If you already know about a specific topic, feel free to skip around through
the other articles.</p>
<div class="seriesmeta">This entry is part 1 of 3 in the series <a href="http://blog.sanctum.geek.nz/series/linux-crypto/" class="series-454" title="Linux Crypto">Linux Crypto</a>.</div><img src="http://feeds.feedburner.com/~r/arabesqueblog/~4/m71ZiJklKHA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.sanctum.geek.nz/linux-crypto-introduction/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
	
		<series:name><![CDATA[Linux Crypto]]></series:name>
	<feedburner:origLink>http://blog.sanctum.geek.nz/linux-crypto-introduction/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=linux-crypto-introduction</feedburner:origLink></item>
		<item>
		<title>Vim character info</title>
		<link>http://feedproxy.google.com/~r/arabesqueblog/~3/6KcAO_YHNjM/</link>
		<comments>http://blog.sanctum.geek.nz/vim-character-info/#comments</comments>
		<pubDate>Sun, 31 Mar 2013 02:16:22 +0000</pubDate>
		<dc:creator>Tom Ryder</dc:creator>
				<category><![CDATA[Vim]]></category>
		<category><![CDATA[code point]]></category>
		<category><![CDATA[html entities]]></category>
		<category><![CDATA[special characters]]></category>
		<category><![CDATA[unicode]]></category>

		<guid isPermaLink="false">http://blog.sanctum.geek.nz/?p=1194</guid>
		<description><![CDATA[Vim will show you the decimal, octal, and hex index of the character under the cursor if you type ga in normal mode. Keying this on an ASCII a character yields the following in the status bar: &#60;a&#62; 97, Hex &#8230; <a href="http://blog.sanctum.geek.nz/vim-character-info/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Vim will show you the decimal, octal, and hex index of the character under the
cursor if you type <code>ga</code> in normal mode. Keying this on an ASCII <code>a</code> character
yields the following in the status bar:</p>

<pre><code>&lt;a&gt;  97,  Hex 61,  Octal 141
</code></pre>

<p>This information can be useful, but it&#8217;s worth it to extend it to include some
other relevant information, including the Unicode point and name of the
character, its HTML entity name (if applicable), and any <a href="http://blog.sanctum.geek.nz/special-characters-in-vim/">digraph entry
method</a>. This can be done by installing the <a href="https://github.com/tpope/vim-characterize">characterize</a> plugin by
<a href="https://github.com/tpope">Tim Pope</a>.</p>

<p>With this plugin installed, pressing <code>ga</code> over <code>a</code> yields a bit more
information:</p>

<pre><code>&lt;a&gt; 97, \141, U+0061 LATIN SMALL LETTER A
</code></pre>

<p>This really shines however when inspecting characters that are available as
HTML entities, or as Vim digraphs, particularly commonly used characters like
an EM DASH:</p>

<pre><code>&lt;—&gt; 8212, U+2014 EM DASH, ^K-M, &amp;mdash;
</code></pre>

<p>Or a COPYRIGHT SYMBOL:</p>

<pre><code>&lt;©&gt; 169, \251, U+00A9 COPYRIGHT SIGN, ^KCo, ^KcO, :copyright:, &amp;copy;
</code></pre>

<p>Or as one of the eyes in a <a href="http://lookofdisapproval.info/">look of disapproval</a>:</p>

<pre><code>&lt;ಠ&gt; 3232, U+0CA0 KANNADA LETTER TTHA
</code></pre>

<p>Note that <code>ga</code> shows you all the Unicode information for the character, along
with any methods to type it as a digraph, and an appropriate HTML entity if
applicable.</p>

<p>If you work with multibyte characters a lot, whether for internationalization
reasons or for typographical correctness in web pages, this may be very useful
to you.</p>
<img src="http://feeds.feedburner.com/~r/arabesqueblog/~4/6KcAO_YHNjM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.sanctum.geek.nz/vim-character-info/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://blog.sanctum.geek.nz/vim-character-info/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=vim-character-info</feedburner:origLink></item>
		<item>
		<title>Zooming tmux panes</title>
		<link>http://feedproxy.google.com/~r/arabesqueblog/~3/mD2OtW9upQc/</link>
		<comments>http://blog.sanctum.geek.nz/zooming-tmux-panes/#comments</comments>
		<pubDate>Fri, 29 Mar 2013 12:47:40 +0000</pubDate>
		<dc:creator>Tom Ryder</dc:creator>
				<category><![CDATA[Tmux]]></category>
		<category><![CDATA[1.8]]></category>
		<category><![CDATA[panes]]></category>
		<category><![CDATA[zoom]]></category>

		<guid isPermaLink="false">http://blog.sanctum.geek.nz/?p=1189</guid>
		<description><![CDATA[The recently released tmux 1.8 includes a new feature, zoomed panes, that allows temporarily expanding a pane to the full size of the tmux window to see more of its contents. In the man page for tmux(1), the feature is &#8230; <a href="http://blog.sanctum.geek.nz/zooming-tmux-panes/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>The recently released <a href="http://tmux.sourceforge.net/">tmux 1.8</a> includes a new feature, <strong>zoomed panes</strong>,
that allows temporarily expanding a pane to the full size of the tmux window to
see more of its contents.</p>

<p>In the <code>man</code> page for <code>tmux(1)</code>, the feature is described as follows, under the
details for the <code>resize-pane</code> command:</p>

<pre><code>With -Z, the active pane is toggled between zoomed (occupying the
whole of the window) and unzoomed (its normal position in the
layout).
</code></pre>

<p>This command is bound to <code>&lt;prefix&gt; z</code> by default; for most users, this will
be <code>Ctrl-a z</code>. The effect can be observed by pressing this key sequence in any
window with at least two panes, to toggle the zoomed state for the active
pane:</p>

<p><img src="http://blog.sanctum.geek.nz/wp-content/uploads/2013/03/toggle-pane-zoom.gif" alt="Toggle pane zoom state" /></p>

<p>Note the <code>Z</code> suffix that appears after the window title in the status bar while
the pane is zoomed.</p>

<p>For most users, the new feature should mean that any custom maximize/minimize
style bindings they may be using are no longer needed. This works particularly
smoothly given that the new release also includes support for reflowing text
when panes and windows are resized, something GNU Screen has supported for some
time.</p>

<p>Be sure to take a look at some of the <a href="http://sourceforge.net/p/tmux/tmux-code/ci/master/tree/CHANGES">other changes</a> in the newest
release of tmux. If you&#8217;re using a DPKG or RPM based packaging system, you
might like to build it from source and <a href="http://blog.sanctum.geek.nz/packaging-built-software/">install it with
<code>checkinstall(8)</code></a>.</p>
<img src="http://feeds.feedburner.com/~r/arabesqueblog/~4/mD2OtW9upQc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.sanctum.geek.nz/zooming-tmux-panes/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		<feedburner:origLink>http://blog.sanctum.geek.nz/zooming-tmux-panes/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=zooming-tmux-panes</feedburner:origLink></item>
		<item>
		<title>RSS with Newsbeuter</title>
		<link>http://feedproxy.google.com/~r/arabesqueblog/~3/izc-XDBDtck/</link>
		<comments>http://blog.sanctum.geek.nz/rss-with-newsbeuter/#comments</comments>
		<pubDate>Sat, 16 Mar 2013 11:46:16 +0000</pubDate>
		<dc:creator>Tom Ryder</dc:creator>
				<category><![CDATA[Terminal]]></category>
		<category><![CDATA[atom]]></category>
		<category><![CDATA[feeds]]></category>
		<category><![CDATA[google reader]]></category>
		<category><![CDATA[migration]]></category>
		<category><![CDATA[newsbeuter]]></category>
		<category><![CDATA[rss]]></category>

		<guid isPermaLink="false">http://blog.sanctum.geek.nz/?p=1169</guid>
		<description><![CDATA[The recent announcement that Google Reader will no longer be available from July 1st has prompted many of its current users to look for alternative RSS reader applications. Despite the panic, there are plenty of other web-based and GUI options, &#8230; <a href="http://blog.sanctum.geek.nz/rss-with-newsbeuter/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>The recent announcement that Google Reader will <a href="http://googleblog.blogspot.in/2013/03/a-second-spring-of-cleaning.html">no longer be available</a>
from July 1st has prompted many of its current users to look for alternative
RSS reader applications. Despite the panic, there are plenty of other web-based
and GUI options, but text user interface enthusiasts (and Arabesque readers)
may find <a href="http://www.newsbeuter.org/">Newsbeuter</a> worth a look in particular.</p>

<p><img src="http://blog.sanctum.geek.nz/wp-content/uploads/2013/03/newsbeuter-article.png" alt="Newsbeuter reading an article" /></p>

<p>Newsbeuter refers to itself as &#8220;the <a href="http://www.mutt.org/">Mutt</a> of RSS readers&#8221;, alluding to
its keystroke-driven <code>ncurses(3)</code> interface, plaintext configuration with many
options, and extensive feature set. If you like the idea of using a client-side
RSS reader in a terminal, then this may be ideal for you.</p>

<p>Having a client-side reader is particularly valuable if you follow feeds which
aren&#8217;t available on the public internet, or if you would prefer to keep your
subscriptions relatively private. While Google Reader&#8217;s search is very good,
it&#8217;s also handy to have a local cache of feed items to search, which is
a feature of Newsbeuter.</p>

<h2>Installing Newsbeuter</h2>

<p>Newsbeuter can be <a href="http://www.newsbeuter.org/download.html">downloaded and built from source</a>, or there are
packages available in most Linux distributions. On Debian-derived systems, it&#8217;s
available in the <code>newsbeuter</code> package:</p>

<pre><code># apt-get install newsbeuter
</code></pre>

<p>Newsbeuter will throw an error if you try to start it with no feeds defined.
We&#8217;ll be fixing that shortly.</p>

<h2>Exporting Google Reader feeds</h2>

<p>If you&#8217;re using Google Reader, you should start by exporting your feeds in
<a href="http://en.wikipedia.org/wiki/OPML">OPML format</a> format using Google Takeout. You can do this by going to
<strong>Reader Settings</strong> -> <strong>Import/Export</strong> -> <strong>Download your data through
Takeout</strong>:</p>

<p><img src="http://blog.sanctum.geek.nz/wp-content/uploads/2013/03/export-google-reader-feeds.png" alt="Export Google Reader feeds" /></p>

<p>This leads you to the Google Takeout page, and offers you a download of all of
your Google Reader data, which you can retrieve by clicking <strong>Create Archive</strong>.
The downloaded zip file will contain (within a couple of directories) a file
called <code>subscriptions.xml</code>. This is the OPML file containing the URLs and
categorizations of all the feeds to which you were subscribed. Save that
somewhere accessible on the Linux or BSD machine on which you intend to run
Newsbeuter.</p>

<h2>Importing feeds into Newsbeuter</h2>

<p>Once you have your <code>subscriptions.xml</code> file ready for import, you can import
the data straight into Newsbeuter using the <code>-i</code> option:</p>

<pre><code>$ newsbeuter -i subscriptions.xml
Import of subscriptions finished.
</code></pre>

<p>With this done, you should be able to start Newsbeuter with no options, and its
main interface will start with the URLs to all your feeds:</p>

<p><img src="http://blog.sanctum.geek.nz/wp-content/uploads/2013/03/newsbeuter-urls.png" alt="Newsbeuter with imported URLs" /></p>

<p>You&#8217;ll note that none of these have any items yet; this is because the defaults
for Newsbeuter are to fetch the articles only on demand, not automatically. You
can start this process by pressing <code>R</code> for <strong>Reload All</strong>, at which point the
titles of your feeds will appear, along with a count of their unread items:</p>

<p><img src="http://blog.sanctum.geek.nz/wp-content/uploads/2013/03/newsbeuter-titles.png" alt="Newsbeuter with feed titles and counts" /></p>

<h2>Some useful keystrokes</h2>

<p>From here, the basics are pretty intuitive; you can move around with the cursor
keys, and select feeds and items within them with <code>Enter</code>. You can press <code>q</code> to
move up a screen, and to quit the program; <code>Q</code> will quit unconditionally from
any screen.</p>

<p>You can move to next and previous feed items with <code>Ctrl-j</code> and <code>Ctrl-k</code>. A nice
quick way to read everything is to cycle through unread items across all feeds
with <code>n</code>. You can save the complete text of an article with <code>s</code>, and search for
articles matching a string (not a regular expression) with <code>/</code>.</p>

<p>You can press <code>o</code> to open the feed&#8217;s URL in a browser; this works fine if
you&#8217;re using an X server, but you can also configure this to be a command-line
browser like <code>lynx</code> if you&#8217;d prefer with the <code>browser</code> option in the
configuration file. If you&#8217;re using PuTTY and you&#8217;re going to be copy-pasting
URLs from your terminal window, it helps to make sure you&#8217;ve configured it to
<a href="http://tech.arantius.com/select-urls-in-putty">easily select URLs on double-click</a>.</p>

<p>A complete list of all the keystrokes is available by pressing <code>?</code>.</p>

<h2>Managing feeds</h2>

<p>Adding, removing, and tagging feeds is all done with the <code>urls</code> file. This
might be saved in either <code>~/.config/newsbeuter/urls</code>, or <code>~/.newsbeuter/urls</code>.
Either way, you can edit it directly within the program using <code>E</code>, which will
start your <code>$EDITOR</code> to manage the URLs. Add and remove feed URLs, save the
file, quit, and you&#8217;re done; Newsbeuter will reload its defined feeds
automatically once the editor is closed.</p>

<h2>Tags</h2>

<p>If you imported your feeds from Google Reader and you were using folders to
keep your feeds organised, you may note that in your <code>urls</code> file in Newsbeuter
the names of the folders are included in quotes at the end of each line:</p>

<pre><code>http://www.debian-administration.org/atom.xml "Tech"
http://www.jerkcity.com/jc.rss "Comics"
http://www.kiwiblog.co.nz/feed "Politics"
</code></pre>

<p>These are <strong>tags</strong>, Newsbeuter&#8217;s way of organising feeds non-hierarchically. If
you have such tags defined, you can limit your view of feeds to a particular
tag by pressing <code>t</code> to show only those matching feeds. You can press <code>Ctrl-t</code>
to back out of that view and show all feeds again.</p>

<p>Creating a new tag is done by editing the <code>urls</code> file as above. Add the tag in
quotes after the appropriate feed URLs. Note that you can have more than one
tag for each URL:</p>

<pre><code>http://www.debian-administration.org/atom.xml "Tech" "Debian"
</code></pre>

<h2>Configuration</h2>

<p>The Newsbeuter configuration file might be in either
<code>~/.config/newsbeuter/config</code> or <code>~/.newsbeuter/config</code>. The following
options might be useful:</p>

<ul>
<li><code>auto-reload yes</code> &#8212; Check all feeds for new items on startup, and
periodically thereafter.</li>
<li><code>reload-time 30</code> &#8212; Re-check all feeds automatically every 30 minutes.</li>
<li><code>notify-beep yes</code> &#8212; Send a console beep every time new items are found.
You will probably only want this if you are dealing sensibly with bells,
for example with a visual bell system in GNU Screen or tmux, otherwise you
may find an audible bell annoying.</li>
<li><code>confirm-exit yes</code> &#8212; Prompt before quitting. Tapping <code>q</code> to get to the
top screen is a little error-prone, and it&#8217;s easy to quit accidentally.</li>
</ul>

<p>The colorscheme for the application can also be customized here, and the
keybindings too. See the <a href="http://www.newsbeuter.org/doc/newsbeuter.html#_first_steps">Newsbeuter documentation</a> for a complete list of
configuration options.</p>

<h2>User agents</h2>

<p>You may find that some feeds don&#8217;t return any information when you use
Newsbeuter, probably because the <a href="http://en.wikipedia.org/wiki/User_agent">user agent</a> string it sends is not
recognised as an RSS reader. The feed for the <a href="http://abstrusegoose.com/">Abstruse Goose</a> comic is an
example, as is <a href="http://www.toothpastefordinner.com/">Toothpaste for Dinner</a>.</p>

<p>The easiest way to work around this is to make Newsbeuter identify itself as
a better-known RSS reader. I&#8217;ve found that pretending to be <a href="http://lzone.de/liferea/">Liferea</a>
works:</p>

<pre><code>user-agent "Liferea/1.4.14 (Linux; en_US.UTF8; http://liferea.sf.net/)"
</code></pre>

<p>With this done and Newsbeuter restarted, the feeds seem more willing to yield
their items for reading.</p>

<p><em>Daniel Aleksandersen <a href="http://blog.sanctum.geek.nz/rss-with-newsbeuter/#comment-7683">points out in the comments</a> that this is probably
because Newsbeuter used a suspicious user agent string until <a href="https://github.com/akrennmair/newsbeuter/commit/02d90d25f717e6578b8c0ad21af47cd79fdb3709">his patch for
2.6</a>. If you are using Newsbeuter 2.6 or newer, then you may not need to
do the above.</em></p>

<h2>Special feeds</h2>

<p>If you can&#8217;t directly retrieve your feed from a URL, but need to generate it
programatically from a script or use a tool like <code>curl</code> to retrieve it, you can
use special <code>exec:</code> URLs in the <code>urls</code> file to manage this. For example, to
retrieve an RSS feed of my work&#8217;s network changelist, I do something like this:</p>

<pre><code>"exec:ssh work curl http://changelog.worknet/rss.xml"
</code></pre>

<p>This retrieves the feed using <code>curl(1)</code> over <code>ssh(1)</code>, and presents it as
a normal feed in Newsbeuter. Note the quotes are required for any command that
includes spaces.</p>

<p>Though I will miss Google Reader, I&#8217;ve found Newsbeuter a great replacement,
and it fits very nicely as a permanent window in my <code>tmux(1)</code> session.
Hopefully you&#8217;ll find it suits you too, and works well with your
terminal-based workflow.</p>
<img src="http://feeds.feedburner.com/~r/arabesqueblog/~4/izc-XDBDtck" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.sanctum.geek.nz/rss-with-newsbeuter/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		<feedburner:origLink>http://blog.sanctum.geek.nz/rss-with-newsbeuter/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=rss-with-newsbeuter</feedburner:origLink></item>
		<item>
		<title>TERM strings</title>
		<link>http://feedproxy.google.com/~r/arabesqueblog/~3/dh-EYofET20/</link>
		<comments>http://blog.sanctum.geek.nz/term-strings/#comments</comments>
		<pubDate>Sat, 26 Jan 2013 07:38:00 +0000</pubDate>
		<dc:creator>Tom Ryder</dc:creator>
				<category><![CDATA[Terminal]]></category>
		<category><![CDATA[term strings]]></category>
		<category><![CDATA[terminal types]]></category>
		<category><![CDATA[terminfo]]></category>

		<guid isPermaLink="false">http://blog.sanctum.geek.nz/?p=1141</guid>
		<description><![CDATA[A certain piece of very misleading advice is often given online to users having problems with the way certain command-line applications are displaying in their terminals. This is to suggest that the user change the value of their TERM environment &#8230; <a href="http://blog.sanctum.geek.nz/term-strings/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>A certain piece of very misleading advice is often given online to users having
problems with the way certain command-line applications are displaying in their
terminals. This is to suggest that the user change the value of their <code>TERM</code>
environment variable from within the shell, doing something like this:</p>

<pre><code>$ TERM=xterm-256color
</code></pre>

<p>This misinformation sometimes extends to suggesting that users put the forced
<code>TERM</code> change into their shell startup scripts. The reason this is such a bad
idea is that it forces your shell to assume what your terminal is, and thereby
disregards the initial terminal identity string sent by the emulator. This
leads to a lot of confusion when one day you need to connect with a very
different terminal emulator.</p>

<h2>Accounting for differences</h2>

<p>All terminal emulators are not created equal. Certainly, not all of them are
<a href="http://linux.die.net/man/1/xterm"><code>xterm(1)</code></a>, although many other terminal emulators do a decent but not
comprehensive job of copying it. The value of the <code>TERM</code> environment variable
is used by the system running the shell to determine what the terminal
connecting to it can and cannot do, what control codes to send to the program
to use those features, and how the shell should understand the input of certain
key codes, such as the Home and End keys. These things in particular are
common causes of frustration for new users who turn out to be using a forced
<code>TERM</code> string.</p>

<p>Instead, focus on these two guidelines for setting <code>TERM</code>:</p>

<ol>
<li><p>Avoid setting <code>TERM</code> from within the shell, <em>especially</em> in your
startup scripts like <code>.bashrc</code> or <code>.bash_profile</code>. If that ever seems like
the answer, then you are probably asking the wrong question! The terminal
identification string should <em>always</em> be sent by the terminal emulator you
are using; if you do need to change it, then change it in the settings for
the emulator.</p></li>
<li><p>Always use an appropriate <code>TERM</code> string that accurately describes what
your choice of terminal emulator can and cannot display. Don&#8217;t make an
<a href="http://linux.die.net/man/1/rxvt"><code>rxvt(1)</code></a> terminal identify itself as <code>xterm</code>; don&#8217;t make a <code>linux</code>
console identify itself as <code>vt100</code>; and don&#8217;t make an <code>xterm(1)</code> compiled
without 256 color support refer to itself as <code>xterm-256color</code>.</p></li>
</ol>

<p>In particular, note that sometimes for compatibility reasons, the default
terminal identification used by an emulator is given as something generic like
<code>xterm</code>, when in fact a more accurate or comprehensive terminal identity file
is more than likely available for your particular choice of terminal emulator
with a little searching.</p>

<p>An example that surprises a lot of people is the availability of the <code>putty</code>
terminal identity file, when the application defaults to presenting itself as
an imperfect <code>xterm(1)</code> emulator.</p>

<h2>Configuring your emulator&#8217;s string</h2>

<p>Before you change your terminal string in its settings, check whether the
default it uses is already the correct one, with one of these:</p>

<pre><code>$ echo $TERM
$ tset -q
</code></pre>

<p>Most builds of <code>rxvt(1)</code>, for example, should already use the correct <code>TERM</code>
string by default, such as <code>rxvt-unicode-256color</code> for builds with 256 colors
and Unicode support.</p>

<p>Where to configure which <code>TERM</code> string your terminal uses will vary depending
on the application. For <code>xterm(1)</code>, your <code>.Xresources</code> file should contain
a definition like the below:</p>

<pre><code>XTerm*termName: xterm-256color
</code></pre>

<p>For <code>rxvt(1)</code>, the syntax is similar:</p>

<pre><code>URxvt*termName: rxvt-unicode-256color
</code></pre>

<p>Other GTK and Qt emulators sometimes include the setting somewhere in
their preferences. Look for mentions of <code>xterm</code>, a common fallback default.</p>

<p>For Windows PuTTY, it&#8217;s configurable under the &#8221;&#8217;Connections > Data&#8221;&#8217;
section:</p>

<p><img src="http://blog.sanctum.geek.nz/wp-content/uploads/2012/12/putty-term-setting.png" alt="Setting the terminal string in PuTTY" /></p>

<p>More detail about configuring PuTTY for connecting to modern systems can be
found in my <a href="http://blog.sanctum.geek.nz/putty-configuration/">article on configuring PuTTY</a>.</p>

<h2>Testing your <code>TERM</code> string</h2>

<p>On Linux systems, an easy way to test the terminal capabilities (particularly
effects like colors and reverse video) is using the <a href="http://linux.die.net/man/1/msgcat"><code>msgcat(1)</code></a> utility:</p>

<pre><code>$ msgcat --color=test
</code></pre>

<p>This will output a large number of tests of various features to the terminal,
so that you can check their appearance is what you expect.</p>

<h2>Finding appropriate <code>terminfo(5)</code> definitions</h2>

<p>On Linux systems, the capabilities and behavior of various terminal types is
described using <a href="http://linux.die.net/man/5/terminfo"><code>terminfo(5)</code></a> files, usually installed as part of the
<code>ncurses</code> package. These files are often installed in <code>/lib/terminfo</code> or
<code>/usr/share/terminfo</code>, in subdirectories by first letter.</p>

<p>In order to use a particular <code>TERM</code> string, an appropriate file must exist in
one of these directories. On Debian-derived systems, a large collection of
terminal types can be installed to the system with the <a href="http://packages.debian.org/stable/admin/ncurses-term"><code>ncurses-term</code></a>
package.</p>

<p>For example, the following variants of the <code>rxvt</code> terminal emulator are all
available:</p>

<pre><code>$ cd /usr/share/terminfo/r
$ ls rxvt*
rxvt-16color  rxvt-256color  rxvt-88color  rxvt-color  rxvt-cygwin
rxvt-cygwin-native  rxvt+pcfkeys  rxvt-unicode-256color  rxvt-xpm 
</code></pre>

<h2>Private and custom <code>terminfo(5)</code> files</h2>

<p>If you connect to a system that doesn&#8217;t have a <code>terminfo(5)</code> definition to
match the <code>TERM</code> definition for your particular terminal, you might get a
message similar to this on login:</p>

<pre><code>setterm: rxvt-unicode-256color: unknown terminal type
tput: unknown terminal "rxvt-unicode-256color"
$
</code></pre>

<p>If you&#8217;re not able to install the appropriate terminal definition system-wide,
one technique is to use a private <code>.terminfo</code> directory in your home directory
containing the definitions you need:</p>

<pre><code>$ cd ~/.terminfo
$ find
.
./x
./x/xterm-256color
./x/xterm
./r
./r/rxvt-256color
./r/rxvt-unicode-256color
./r/rxvt
./s
./s/screen
./s/screen-256color
./p
./p/putty-256color
./p/putty
</code></pre>

<p>You can copy this to your home directory on the servers you manage with a tool
like <code>scp</code>:</p>

<pre><code>$ scp -r .terminfo server:
</code></pre>

<h2><code>TERM</code> and multiplexers</h2>

<p>Terminal multiplexers like <a href="http://linux.die.net/man/1/screen"><code>screen(1)</code></a> and <a href="http://www.openbsd.org/cgi-bin/man.cgi?query=tmux&amp;sektion=1"><code>tmux(1)</code></a> are special
cases, and they cause perhaps the most confusion to people when inaccurate
<code>TERM</code> strings are used. The <a href="http://sourceforge.net/p/tmux/tmux-code/ci/master/tree/FAQ">tmux FAQ</a> even opens by saying that most of
the display problems reported by people are due to incorrect <code>TERM</code> settings,
and a good portion of the codebase in both multiplexers is dedicated to
negotiating the differences between terminal capacities.</p>

<p>This is because they are &#8220;terminals within terminals&#8221;, and provide their own
functionality only within the bounds of what the <em>outer</em> terminal can do. In
addition to this, they have their own type for terminals within them; both of
them use <code>screen</code> and its variants, such as <code>screen-256color</code>.</p>

<p>It&#8217;s therefore very important to check that both the <em>outer</em> and <em>inner</em>
definitions for <code>TERM</code> are correct. In <code>.screenrc</code> it usually suffices to use
a line like the following:</p>

<pre><code>term screen
</code></pre>

<p>Or in <code>.tmux.conf</code>:</p>

<pre><code>set-option -g default-terminal screen
</code></pre>

<p>If the outer terminals you use consistently have 256 color capabilities, you
may choose to use the <code>screen-256color</code> variant instead.</p>

<p>If you follow all of these guidelines, your terminal experience will be much
smoother, as your terminal and your system will understand each other that much
better. You may find that this fixes a lot of struggles with interactive tools
like <a href="http://linux.die.net/man/1/vim"><code>vim(1)</code></a>, for one thing, because if the application is able to
divine things like the available color space directly from terminal information
files, it saves you from having to include nasty hacks on the <code>t_Co</code> variable
in your <code>.vimrc</code>.</p>
<img src="http://feeds.feedburner.com/~r/arabesqueblog/~4/dh-EYofET20" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.sanctum.geek.nz/term-strings/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		<feedburner:origLink>http://blog.sanctum.geek.nz/term-strings/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=term-strings</feedburner:origLink></item>
		<item>
		<title>PuTTY configuration</title>
		<link>http://feedproxy.google.com/~r/arabesqueblog/~3/9c0EBdiQWww/</link>
		<comments>http://blog.sanctum.geek.nz/putty-configuration/#comments</comments>
		<pubDate>Sat, 22 Dec 2012 08:11:28 +0000</pubDate>
		<dc:creator>Tom Ryder</dc:creator>
				<category><![CDATA[PuTTY]]></category>
		<category><![CDATA[256]]></category>
		<category><![CDATA[client]]></category>
		<category><![CDATA[configuration]]></category>
		<category><![CDATA[font]]></category>
		<category><![CDATA[utf-8]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://blog.sanctum.geek.nz/?p=1111</guid>
		<description><![CDATA[PuTTY is a terminal emulator with a free software license, including an SSH client. While it has cross-platform ports, it&#8217;s used most frequently on Windows systems, because they otherwise lack a built-in terminal emulator that interoperates well with Unix-style TTY &#8230; <a href="http://blog.sanctum.geek.nz/putty-configuration/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>PuTTY is a terminal emulator with a free software license, including an SSH
client. While it has cross-platform ports, it&#8217;s used most frequently on Windows
systems, because they otherwise lack a built-in terminal emulator that
interoperates well with Unix-style TTY systems.</p>

<p>While it&#8217;s very popular and useful, PuTTY&#8217;s defaults are quite old, and are
chosen for compatibility reasons rather than to take advantage of all the
features of a more complete terminal emulator. For new users, this is likely an
advantage as it can avoid confusion, but more advanced users who need to use
a Windows client to connect to a modern Linux system may find the defaults
frustrating, particularly when connecting to a more capable and
custom-configured server.</p>

<p>Here are a few of the problems with the default configuration:</p>

<ul>
<li>It identifies itself as an <code>xterm(1)</code>, when <code>terminfo(5)</code> definitions are
available named <code>putty</code> and <code>putty-256color</code>, which more precisely define
what the terminal can and cannot do, and their various custom escape
sequences.</li>
<li>It only allows 16 colors, where most modern terminals are capable of using
256; this is partly tied into the terminal type definition.</li>
<li>It doesn&#8217;t use UTF-8 by default, which <a href="http://www.utf8everywhere.org/">should be used whenever
possible</a> for reasons of interoperability and compatibility, and is
well-supported by modern <code>locale</code> definitions on Linux.</li>
<li>It uses Courier New, a workable but rather harsh monospace font, which
should be swapped out for something more modern if available.</li>
<li>It uses audible terminal bells, which tend to be annoying.</li>
<li>Its default palette based on <code>xterm(1)</code> is rather garish and harsh; softer
colors are more pleasant to read.</li>
</ul>

<p>All of these things are fixable.</p>

<h2>Terminal type</h2>

<p>Usually the most important thing in getting a terminal working smoothly is to
make sure it identifies itself correctly to the machine to which it&#8217;s
connecting, using an appropriate <code>$TERM</code> string. By default, PuTTY identifies
itself as an <code>xterm(1)</code> terminal emulator, which most systems will support.</p>

<p>However, there&#8217;s a <code>terminfo(5)</code> definition for <code>putty</code> and <code>putty-256color</code>
available as part of <code>ncurses</code>, and if you have it available on your system
then you should use it, as it slightly more precisely describes the features
available to PuTTY as a terminal emulator.</p>

<p>You can check that you have the appropriate <code>terminfo(5)</code> definition installed
by looking in <code>/usr/share/terminfo/p</code>:</p>

<pre><code>$ ls -1 /usr/share/terminfo/p/putty*
/usr/share/terminfo/p/putty  
/usr/share/terminfo/p/putty-256color  
/usr/share/terminfo/p/putty-sco  
/usr/share/terminfo/p/putty-vt100
</code></pre>

<p>On Debian and Ubuntu systems, these files can be installed with:</p>

<pre><code># apt-get install ncurses-term
</code></pre>

<p>If you can&#8217;t install the files via your system&#8217;s package manager, you can also
keep a private repository of <code>terminfo(5)</code> files in your home directory, in
a directory called <code>.terminfo</code>:</p>

<pre><code>$ ls -1 $HOME/.terminfo/p
putty
putty-256color
</code></pre>

<p>Once you have this definition installed, you can instruct PuTTY to identify
with that <code>$TERM</code> string in the <strong>Connection > Data</strong> section:</p>

<p><img src="http://blog.sanctum.geek.nz/wp-content/uploads/2012/12/putty-term-setting.png" alt="Correct terminal definition in PuTTY" /></p>

<p>Here, I&#8217;ve used <code>putty-256color</code>; if you don&#8217;t need or want a 256 color
terminal you could just use <code>putty</code>.</p>

<p>Once connected, make sure that your <code>$TERM</code> string matches what you specified,
and hasn&#8217;t been mangled by any of your shell or terminal configurations:</p>

<pre><code>$ echo $TERM
putty-256color
</code></pre>

<h2>Color space</h2>

<p>Certain command line applications like Vim and Tmux can take advantage of
<a href="http://blog.sanctum.geek.nz/256-colour-terminals/">a full 256 colors</a> in the terminal. If you&#8217;d like to use this, set
PuTTY&#8217;s <code>$TERM</code> string to <code>putty-256color</code> as outlined above, and select
<strong>Allow terminal to use xterm 256-colour mode</strong> in <strong>Window > Colours</strong>:</p>

<p><img src="http://blog.sanctum.geek.nz/wp-content/uploads/2012/12/putty-256-colors.png" alt="256 colours in PuTTY" /></p>

<p>You can test this is working by using a 256 color application, or by trying out
the terminal colours directly in your shell using <code>tput</code>:</p>

<pre><code>$ for color in $(seq 0 255); do
&gt; tput setaf $color &amp;&amp; echo -n "test"
&gt; done
</code></pre>

<p>If you see the word <code>test</code> in many different colors, then things are probably
working. Type <code>reset</code> to fix your terminal after this:</p>

<pre><code>$ reset
</code></pre>

<h2>Using UTF-8</h2>

<p>If you&#8217;re connecting to a modern GNU/Linux system, it&#8217;s likely that you&#8217;re
using a UTF-8 locale. You can check which one by typing <code>locale</code>. In my case,
I&#8217;m using the <code>en_NZ</code> locale with <code>UTF-8</code> character encoding:</p>

<pre><code>$ locale
LANG=en_NZ.UTF-8
LANGUAGE=en_NZ:en
LC_CTYPE="en_NZ.UTF-8"
LC_NUMERIC="en_NZ.UTF-8"
LC_TIME="en_NZ.UTF-8"
LC_COLLATE="en_NZ.UTF-8"
LC_MONETARY="en_NZ.UTF-8"
LC_MESSAGES="en_NZ.UTF-8"
LC_PAPER="en_NZ.UTF-8"
LC_NAME="en_NZ.UTF-8"
LC_ADDRESS="en_NZ.UTF-8"
LC_TELEPHONE="en_NZ.UTF-8"
LC_MEASUREMENT="en_NZ.UTF-8"
LC_IDENTIFICATION="en_NZ.UTF-8"
LC_ALL=
</code></pre>

<p>If the output of <code>locale</code> does show you&#8217;re using a UTF-8 character encoding,
then you should configure PuTTY to interpret terminal output using that
character set; it can&#8217;t detect it automatically (which isn&#8217;t PuTTY&#8217;s fault;
it&#8217;s a known hard problem). You do this in the <strong>Window > Translation</strong>
section:</p>

<p><img src="http://blog.sanctum.geek.nz/wp-content/uploads/2012/12/putty-utf-8.png" alt="Using UTF-8 encoding in PuTTY" /></p>

<p>While you&#8217;re in this section, it&#8217;s best to choose the <strong>Use Unicode line
drawing code points</strong> option as well. Line-drawing characters are most likely
to work properly with this setting for UTF-8 locales and modern fonts:</p>

<p><img src="http://blog.sanctum.geek.nz/wp-content/uploads/2012/12/putty-unicode-line-drawing.png" alt="Using Unicode line-drawing points in PuTTY" /></p>

<p>If Unicode and its various encodings is new to you, I highly recommend <a href="http://www.joelonsoftware.com/articles/Unicode.html">Joel
Spolsky&#8217;s classic article</a> about what programmers should know about both.</p>

<h2>Fonts</h2>

<p>Courier New is a workable monospace font, but modern Windows systems include
<a href="http://en.wikipedia.org/wiki/Consolas">Consolas</a>, a much nicer terminal font. You can change this in the
<strong>Window > Appearance</strong> section:</p>

<p><img src="http://blog.sanctum.geek.nz/wp-content/uploads/2012/12/putty-consolas.png" alt="Using Consolas font in PuTTY" /></p>

<p>There&#8217;s no reason you can&#8217;t use another favourite Bitmap or TrueType font
instead once it&#8217;s installed on your system; <a href="http://dejavu-fonts.org/wiki/Main_Page">DejaVu Sans Mono</a>,
<a href="http://levien.com/type/myfonts/inconsolata.html">Inconsolata</a>, and <a href="http://terminus-font.sourceforge.net/">Terminus</a> are popular alternatives. I personally
favor <a href="http://font.ubuntu.com/">Ubuntu Mono</a>.</p>

<h2>Bells</h2>

<p>Terminal bells by default in PuTTY emit the system alert sound. Most people
find this annoying; some sort of visual bell tends to be much better if you
want to use the bell at all. Configure this in <strong>Terminal > Bell</strong>:</p>

<p><img src="http://blog.sanctum.geek.nz/wp-content/uploads/2012/12/putty-bell.png" alt="Using taskbar bell in PuTTY" /></p>

<p>Given the purpose of the alert is to draw attention to the window, I find
that using a flashing taskbar icon works well; I use this to draw my attention
to my prompt being displayed after a long task completes, or if someone
mentions my name or directly messages me in <code>irssi(1)</code>.</p>

<p>Another option is using the <strong>Visual bell (flash window)</strong> option, but
I personally find this even worse than the audible bell.</p>

<h2>Default palette</h2>

<p>The default colours for PuTTY are rather like those used in <code>xterm(1)</code>, and
hence rather harsh, particularly if you&#8217;re used to the slightly more subdued
colorscheme of terminal emulators like <code>gnome-terminal(1)</code>, or have customized
your palette to something like <a href="http://ethanschoonover.com/solarized">Solarized</a>.</p>

<p>If you have decimal RGB values for the colours you&#8217;d prefer to use, you can
enter those in the <strong>Window > Colours</strong> section, making sure that <strong>Use system
colours</strong> and <strong>Attempt to use logical palettes</strong> are unchecked:</p>

<p><img src="http://blog.sanctum.geek.nz/wp-content/uploads/2012/12/putty-colorscheme.png" alt="Defining colorschemes in PuTTY" /></p>

<p>There are a few other default annoyances in PuTTY, but the above are the
ones that seem to annoy advanced users most frequently. Dag Wieers has
<a href="http://dag.wieers.com/blog/content/improving-putty-settings-on-windows">a similar post</a> with a few more defaults to fix.</p>
<img src="http://feeds.feedburner.com/~r/arabesqueblog/~4/9c0EBdiQWww" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.sanctum.geek.nz/putty-configuration/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		<feedburner:origLink>http://blog.sanctum.geek.nz/putty-configuration/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=putty-configuration</feedburner:origLink></item>
		<item>
		<title>Additional sshd ports</title>
		<link>http://feedproxy.google.com/~r/arabesqueblog/~3/h2aoTWmjERE/</link>
		<comments>http://blog.sanctum.geek.nz/additional-sshd-ports/#comments</comments>
		<pubDate>Tue, 11 Dec 2012 05:00:42 +0000</pubDate>
		<dc:creator>Tom Ryder</dc:creator>
				<category><![CDATA[SSH]]></category>
		<category><![CDATA[additional ports]]></category>
		<category><![CDATA[multiple ports]]></category>
		<category><![CDATA[workaround]]></category>

		<guid isPermaLink="false">http://blog.sanctum.geek.nz/?p=1092</guid>
		<description><![CDATA[Occasionally you may find yourself using a network behind a firewall that doesn&#8217;t allow outgoing TCP connections with a destination port of 22, meaning you&#8217;re unable to connect to your OpenSSH server, perhaps to take advantage of a SOCKS proxy &#8230; <a href="http://blog.sanctum.geek.nz/additional-sshd-ports/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Occasionally you may find yourself using a network behind a firewall that
doesn&#8217;t allow outgoing TCP connections with a destination port of 22, meaning
you&#8217;re unable to connect to your OpenSSH server, perhaps to take advantage of
a <a href="http://blog.sanctum.geek.nz/ssh-socks-and-curl/">SOCKS proxy</a> for encrypted and unfiltered web browsing.</p>

<p>Since these restricted networks almost always allow port 443 out, since it&#8217;s
the destination port for outgoing HTTPS requests, an easy workaround is to have
your OpenSSH server listen on port 443 if it isn&#8217;t already using the port.</p>

<p>This is sometimes given as a rationale for changing the <code>sshd</code> port completely,
but you don&#8217;t need to do that; you can simply add another <code>Port</code> directive to
<a href="http://linux.die.net/man/5/sshd_config"><code>sshd_config(5)</code></a>:</p>

<pre><code>Port 22
Port 443
</code></pre>

<p>After restarting the OpenSSH server with this new line in place, you can verify
that it&#8217;s listening with <a href="http://linux.die.net/man/8/ss"><code>ss(8)</code></a> or <a href="http://linux.die.net/man/8/netstat"><code>netstat(8)</code></a></p>

<pre><code># ss -lnp src :22
State      Recv-Q Send-Q    Local Address:Port      Peer Address:Port
LISTEN     0      128                  :::22                  :::*
users:(("sshd",3039,6))
LISTEN     0      128                   *:22                   *:*
users:(("sshd",3039,5))
# ss -lnp src :443
State      Recv-Q Send-Q    Local Address:Port      Peer Address:Port
LISTEN     0      128                  :::443                 :::*
users:(("sshd",3039,4))
LISTEN     0      128                   *:443                  *:*
users:(("sshd",3039,3))
</code></pre>

<p>You&#8217;ll then be able to connect to the server on port 443, the same way you
would on port 22. If you intend this setup to be permanent, it would be a good
idea to <a href="http://blog.sanctum.geek.nz/uses-for-ssh-config/">save the configuration</a> in your <a href="http://linux.die.net/man/5/ssh_config"><code>ssh_config(5)</code></a> file, or
whichever SSH client you happen to use.</p>
<img src="http://feeds.feedburner.com/~r/arabesqueblog/~4/h2aoTWmjERE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.sanctum.geek.nz/additional-sshd-ports/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		<feedburner:origLink>http://blog.sanctum.geek.nz/additional-sshd-ports/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=additional-sshd-ports</feedburner:origLink></item>
		<item>
		<title>Special characters in Vim</title>
		<link>http://feedproxy.google.com/~r/arabesqueblog/~3/XobulnNcNkM/</link>
		<comments>http://blog.sanctum.geek.nz/special-characters-in-vim/#comments</comments>
		<pubDate>Sat, 24 Nov 2012 01:48:18 +0000</pubDate>
		<dc:creator>Tom Ryder</dc:creator>
				<category><![CDATA[Vim]]></category>
		<category><![CDATA[characters]]></category>
		<category><![CDATA[digraphs]]></category>
		<category><![CDATA[input]]></category>
		<category><![CDATA[special]]></category>
		<category><![CDATA[unicode]]></category>

		<guid isPermaLink="false">http://blog.sanctum.geek.nz/?p=1078</guid>
		<description><![CDATA[Particularly when editing documents for human consumption rather than code, it&#8217;s often necessary to enter special characters into a document that can&#8217;t otherwise be produced by a single key press: Letters with diacritical marks like ä, é, and ô &#8212; &#8230; <a href="http://blog.sanctum.geek.nz/special-characters-in-vim/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Particularly when editing documents for human consumption rather than code,
it&#8217;s often necessary to enter special characters into a document that can&#8217;t
otherwise be produced by a single key press:</p>

<ul>
<li>Letters with diacritical marks like <code>ä</code>, <code>é</code>, and <code>ô</code> &#8212; Vim refers to
these as <strong>digraphs</strong> &#8212; a particular problem when using a US keyboard
layout</li>
<li>Unicode characters like typographic dashes <code>—</code> or copyright symbols <code>©</code>, or
other symbols from the multi-byte portion of the UTF-8 character set
(including foreign languages)</li>
<li>Literal control characters like <code>&lt;Tab&gt;</code></li>
</ul>

<p>Vim has a method for inserting each of these within the editor, rather than
having to copy-paste them from another document. We won&#8217;t discuss Vim&#8217;s
alternative <a href="http://www.polarhome.com/vim/manual/v57/multibyte.html">multibyte input methods</a> here, and will assume that you&#8217;re
using a keyboard with a US or UK layout, and predominantly type in English &#8211;
apologies to international readers, but I do not have another type of keyboard
to test this out!</p>

<p>Some of the following assumes that you&#8217;re using Vim in a UTF-8 capable
terminal, and with the <code>encoding</code> option in your <code>.vimrc</code> set to <code>utf-8</code>,
which is <a href="http://www.utf8everywhere.org/">highly recommended</a> for the vast majority of editing
requirements:</p>

<pre><code>set encoding=utf-8
</code></pre>

<p>It also assumes that your font is capable of displaying all of the characters
concerned; monospace fonts with workable symbol coverage include
<a href="http://en.wikipedia.org/wiki/Consolas">Consolas</a>, <a href="http://levien.com/type/myfonts/inconsolata.html">Inconsolata</a>, and <a href="http://font.ubuntu.com/#charset-mono-regular">Ubuntu Mono</a>.</p>

<h2>Digraphs</h2>

<p>Vim has a special shorthand for entering characters with diacritical marks. If
you need some familiar variant of a Latin alphabet character with a diacritical
mark or embellishment, it&#8217;s likely you&#8217;ll be able to input it with the digraph
system. It also has support for some other sometimes-needed characters like
thorn <code>Þ</code> and eszett <code>ß</code>, and Cyrillic characters.</p>

<p>Digraph input is started in insert or command mode (but not normal mode) by
pressing <code>Ctrl-k</code>, then two printable characters in succession; the first is
often the &#8220;base&#8221; form of the letter, and the second denotes the appropriate
embellishment.</p>

<p>Some simple examples that might occasionally be needed for English speakers to
correctly type one of the language&#8217;s many &#8220;loan words&#8221;:</p>

<ul>
<li><code>Ctrl-k c ,</code> -> <code>ç</code></li>
<li><code>Ctrl-k e '</code> -> <code>é</code></li>
<li><code>Ctrl-k o ^</code> -> <code>ô</code></li>
<li><code>Ctrl-k a !</code> -> <code>à</code></li>
<li><code>Ctrl-k u :</code> -> <code>ü</code></li>
<li><code>Ctrl-k = e</code> -> <code>€</code></li>
</ul>

<p>This is just a small sample; Vim has support for a great many digraphs. Take
a look at the <a href="http://vimdoc.sourceforge.net/htmldoc/digraph.html">relevant section</a> of the documentation for a complete
treatment of the feature. You can also type <code>:digraphs</code> within Vim to get a
complete list of digraphs &#8212; several screenfuls of them!</p>

<p>Note that you can enter all of these characters using the Unicode mode
discussed later in this article as well; two-character mnemonic digraphs simply
happen to be easier to remember than four-digit codes.</p>

<h2>Unicode characters</h2>

<p>For characters not covered in the digraph set, you can also enter unicode
characters by referring to their code page number. In insert or command mode
(but not normal mode) this is done by typing <code>Ctrl-v</code> and then <code>u</code>, followed by
the hexadecimal number. Some potentially useful examples:</p>

<ul>
<li><code>Ctrl-v u 2018</code> -> <code>‘</code>, a LEFT SINGLE QUOTATION MARK</li>
<li><code>Ctrl-v u 2019</code> -> <code>’</code>, a RIGHT SINGLE QUOTATION MARK</li>
<li><code>Ctrl-v u 2014</code> -> <code>—</code>, an EM DASH</li>
<li><code>Ctrl-v u 00a9</code> -> <code>©</code>, a COPYRIGHT SIGN</li>
</ul>

<p>These are handy in some cases when writing HTML documents, as an alternative to
using HTML entities like <code>&amp;mdash;</code> or <code>&amp;copy;</code>. An <a href="http://www.unicode.org/charts/">exhaustive summary</a>
of these characters and their codes is available on the Unicode website.</p>

<h2>Other non-printable characters</h2>

<p>The unicode character input method is actually a specialised case of inputting
literal characters with a <code>Ctrl-v</code> prefix. We can input other non-printable and
control characters using this prefix:</p>

<ul>
<li><code>Ctrl-v &lt;Enter&gt;</code> -> <code>^M</code></li>
<li><code>Ctrl-v &lt;Tab&gt;</code> -> <code>^I</code></li>
</ul>

<p>This is sometimes handy when conforming to someone else&#8217;s tab style, and can
also be handy when searching for characters literally in searches.</p>
<img src="http://feeds.feedburner.com/~r/arabesqueblog/~4/XobulnNcNkM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.sanctum.geek.nz/special-characters-in-vim/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://blog.sanctum.geek.nz/special-characters-in-vim/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=special-characters-in-vim</feedburner:origLink></item>
	</channel>
</rss><!-- Dynamic page generated in 2.046 seconds. --><!-- Cached page generated by WP-Super-Cache on 2013-05-22 03:34:45 -->
