<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	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/"
	>

<channel>
	<title>hocuspokus &#187; terminal</title>
	<atom:link href="http://hocuspokus.net/tag/terminal/feed" rel="self" type="application/rss+xml" />
	<link>http://hocuspokus.net</link>
	<description>the life and times of a code monkey</description>
	<lastBuildDate>Tue, 01 Jun 2010 16:40:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>SSH Shared-Key Setup - SSH Logins Without&#160;Passwords</title>
		<link>http://hocuspokus.net/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fhocuspokus.net%2F2008%2F01%2Fssh-shared-key-setup-ssh-logins-without-passwords&amp;seed_title=SSH+Shared-Key+Setup+-+SSH+Logins+Without%26%23160%3BPasswords</link>
		<comments>http://hocuspokus.net/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fhocuspokus.net%2F2008%2F01%2Fssh-shared-key-setup-ssh-logins-without-passwords&amp;seed_title=SSH+Shared-Key+Setup+-+SSH+Logins+Without%26%23160%3BPasswords#comments</comments>
		<pubDate>Thu, 10 Jan 2008 17:56:59 +0000</pubDate>
		<dc:creator>Daz</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[command-line]]></category>
		<category><![CDATA[geek]]></category>
		<category><![CDATA[os x]]></category>
		<category><![CDATA[terminal]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://hocuspokus.net/2008/01/10/ssh-shared-key-setup-ssh-logins-without-passwords/</guid>
		<description><![CDATA[SSH is a great tool for remotely accessing another machine, but entering your password every time you log into a remote box can be a pain if you would like to set-up some background scripts to connect to a server &#8230; <a href="http://hocuspokus.net/feeder/?FeederAction=clicked&#38;feed=Articles+%28RSS2%29&#38;seed=http%3A%2F%2Fhocuspokus.net%2F2008%2F01%2Fssh-shared-key-setup-ssh-logins-without-passwords&#38;seed_title=SSH+Shared-Key+Setup+-+SSH+Logins+Without%26%23160%3BPasswords">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>SSH is a great tool for remotely accessing another machine, but entering your password every time you log into a remote box can be a pain if you would like to set-up some background scripts to connect to a server and do something (i.e. a backup script running as a cron job).  Here&#8217;s how I set-up my Mac to be able to log into my server without the need for a password to be entered each time - the instructions should be good for any variant of Unix/Linux, but you need to take into account path names etc. on your machine.</p>

<p><span id="more-97"></span></p>

<p>The first thing we will do is generate a key for the SHH version 1 protocol (just in case you are connecting to an older machine):</p>

<pre><code>ssh-keygen -t rsa1
</code></pre>

<p>SSH-Keygen will respond with something like the following:</p>

<pre><code>Generating public/private rsa1 key pair.
Enter file in which to save the key (/Users/daz/.ssh/identity):
</code></pre>

<p>At this point hit enter then you will be prompted for a passphrase - this is a form of password that will be used to generate your unique keys and can contain any set of characters and spaces - something like <em>&quot;I&#8217;m really liking all of this geeky nonsense!&quot;</em> is a perfectly acceptable passphrase - just whatever you do, don&#8217;t use an empty passphrase.  After entering (and confirming) your passphrase you will get the following output:</p>

<pre><code>Your identification has been saved in /Users/daz/.ssh/identity.
Your public key has been saved in /Users/daz/.ssh/identity.pub.
</code></pre>

<p>This means that our identity keys have been generated.  Now we just need to create a pair of keys for the SSH2 protocol - you can use the same or different passphrases for these keys - it&#8217;s up to you&#8230;</p>

<pre><code>ssh-keygen -t dsa
</code></pre>

<p>Then</p>

<pre><code>ssh-keygen -t rsa
</code></pre>

<p>You should now have three sets of keys in your <code>~/.ssh</code> directory, the ones with the .pub extension are your public keys (what we need to put on your other machines) and the others are your private keys - these must be kept safe!</p>

<p>So, let&#8217;s use <code>scp</code> to copy the files across:</p>

<pre><code>scp ~/.ssh/*.pub daz@MyServer:/home/daz/
</code></pre>

<p>Then log into your server using <code>ssh</code> and issue the following commands:</p>

<pre><code>cat identity.pub &gt;&gt;~/.ssh/authorized_keys
cat id_dsa.pub &gt;&gt;~/.ssh/authorized_keys
cat id_rsa.pub &gt;&gt;~/.ssh/authorized_keys
rm identity.pub id_dsa.pub id_rsa.pub
</code></pre>

<p>This populates the <code>authorized_keys</code> file on our server with the three public keys that we have just transferred and then removes them as they&#8217;re no longer needed here.</p>

<p>That&#8217;s everything done, now all we have to do is log out of our server, and then try and log back in via ssh - a password should no longer be required!<sup id="fnref:1"><a href="#fn:1" rel="footnote">1</a></sup> <img src='http://hocuspokus.net/wp-content/plugins/smilies-themer/tango/face-smile.png' alt=':)' class='wp-smiley' /> </p>

<div class="footnotes">
<hr />
<ol>

<li id="fn:1">
<p>This isn&#8217;t strictly true - on OS X it asks you for the <code>id_rsa</code> passphrase that we established before, you will need to enter this, but you can then have it stored in the keychain for hassle free use from here.&#160;<a href="#fnref:1" rev="footnote">&#8617;</a></p>
</li>

</ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://hocuspokus.net/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fhocuspokus.net%2F2008%2F01%2Fssh-shared-key-setup-ssh-logins-without-passwords&amp;seed_title=SSH+Shared-Key+Setup+-+SSH+Logins+Without%26%23160%3BPasswords/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>A Better Ls for Mac OS&#160;X</title>
		<link>http://hocuspokus.net/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fhocuspokus.net%2F2008%2F01%2Fa-better-ls-for-mac-os-x&amp;seed_title=A+Better+Ls+for+Mac+OS%26%23160%3BX</link>
		<comments>http://hocuspokus.net/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fhocuspokus.net%2F2008%2F01%2Fa-better-ls-for-mac-os-x&amp;seed_title=A+Better+Ls+for+Mac+OS%26%23160%3BX#comments</comments>
		<pubDate>Fri, 04 Jan 2008 20:34:48 +0000</pubDate>
		<dc:creator>Daz</dc:creator>
				<category><![CDATA[mac]]></category>
		<category><![CDATA[noteworthy]]></category>
		<category><![CDATA[colour scheme]]></category>
		<category><![CDATA[command-line]]></category>
		<category><![CDATA[ego]]></category>
		<category><![CDATA[geek]]></category>
		<category><![CDATA[os x]]></category>
		<category><![CDATA[terminal]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://hocuspokus.net/2008/01/04/a-better-ls-for-mac-os-x/</guid>
		<description><![CDATA[I&#8217;m a bit of a command-line freak and like to spend a fair amount of time with the terminal open&#8230; As such I like to spend a small amount of time getting the terminal set-up nicely. Other than changing the &#8230; <a href="http://hocuspokus.net/feeder/?FeederAction=clicked&#38;feed=Articles+%28RSS2%29&#38;seed=http%3A%2F%2Fhocuspokus.net%2F2008%2F01%2Fa-better-ls-for-mac-os-x&#38;seed_title=A+Better+Ls+for+Mac+OS%26%23160%3BX">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m a bit of a command-line freak and like to spend a fair amount of time with the terminal open&#8230; As such  I like to spend a small amount of time getting the terminal set-up nicely.  Other than changing the default colour scheme and font, one (slightly) more drastic change is to replace the standard implementation of <code>ls</code> for one that is slightly more configurable.</p>

<p>The default <code>ls</code> on OS X comes from BSD and compared to the GNU/Linux alternative is slightly lacking when it comes to comes to changing how things look - so what I like to do is replace it with the GNU <code>ls</code> available in <a href="http://www.macports.org/">MacPorts</a> - this allows me to get a terminal setup like below:</p>

<div style="text-align:center;"><img src="http://hocuspokus.net/wp-content/uploads/2008/01/terminal.png" alt="terminal.png" /></div>

<p><span id="more-96"></span></p>

<p>To get this done is pretty simple, once you have MacPorts set up correctly (if you can type <code>man port</code> and get a manual page you&#8217;re ready), just run the following command:</p>

<pre><code>sudo port install coreutils +with_default_names
</code></pre>

<p>This installs the &#8216;GNU File, Shell, and Text utilities&#8217; which <code>ls</code> is part of - the extra option at the end <code>+with_default_names</code> makes it override (only override - not replace, this is totally removable) the default <code>ls</code> and other tools otherwise they will have a &#8216;g&#8217; prefix - i.e. <code>ls</code> would be <code>gls</code>.</p>

<p>Next we add some extra configuration to our <code>~/.bash_profile</code> file (i&#8217;ll include my MacPorts config in case you get stuck above)&#8230;</p>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># MacPorts</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">PATH</span>=<span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin:<span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>sbin:<span style="color: #007800;">$PATH</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">MANPATH</span>=<span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">man</span>:<span style="color: #007800;">$MANPATH</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Terminal colours (after installing GNU coreutils)</span>
<span style="color: #007800;">NM</span>=<span style="color: #ff0000;">&quot;\[\033[0;38m\]&quot;</span> <span style="color: #666666; font-style: italic;">#means no background and white lines</span>
<span style="color: #007800;">HI</span>=<span style="color: #ff0000;">&quot;\[\033[0;37m\]&quot;</span> <span style="color: #666666; font-style: italic;">#change this for letter colors</span>
<span style="color: #007800;">HII</span>=<span style="color: #ff0000;">&quot;\[\033[0;31m\]&quot;</span> <span style="color: #666666; font-style: italic;">#change this for letter colors</span>
<span style="color: #007800;">SI</span>=<span style="color: #ff0000;">&quot;\[\033[0;33m\]&quot;</span> <span style="color: #666666; font-style: italic;">#this is for the current directory</span>
<span style="color: #007800;">IN</span>=<span style="color: #ff0000;">&quot;\[\033[0m\]&quot;</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$NM</span>[ <span style="color: #007800;">$HI</span>\u <span style="color: #007800;">$HII</span>\h <span style="color: #007800;">$SI</span>\w<span style="color: #007800;">$NM</span> ] <span style="color: #007800;">$IN</span>&quot;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$TERM</span>&quot;</span> <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;dumb&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">LS_OPTIONS</span>=<span style="color: #ff0000;">'--color=auto'</span>
    <span style="color: #7a0874; font-weight: bold;">eval</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">dircolors</span> ~<span style="color: #000000; font-weight: bold;">/</span>.dir_colors<span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Useful aliases</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;"><span style="color: #c20cb9; font-weight: bold;">ls</span></span>=<span style="color: #ff0000;">'ls $LS_OPTIONS -hF'</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">ll</span>=<span style="color: #ff0000;">'ls $LS_OPTIONS -lhF'</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">l</span>=<span style="color: #ff0000;">'ls $LS_OPTIONS -lAhF'</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> cd..=<span style="color: #ff0000;">&quot;cd ..&quot;</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">c</span>=<span style="color: #ff0000;">&quot;clear&quot;</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">e</span>=<span style="color: #ff0000;">&quot;exit&quot;</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;"><span style="color: #c20cb9; font-weight: bold;">ssh</span></span>=<span style="color: #ff0000;">&quot;ssh -X&quot;</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> ..=<span style="color: #ff0000;">&quot;cd ..&quot;</span></pre></td></tr></table></div>


<p>Then finally we need to create a file called <code>.dir_colors</code> in our home directory that allows us to configure the colours used by <code>ls</code>:</p>

<pre><code>touch ~/.dir_colors
</code></pre>

<p>Then add the contents of the file here:</p>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Configuration file for dircolors, a utility to help you set the</span>
<span style="color: #666666; font-style: italic;"># LS_COLORS environment variable used by GNU ls with the --color option.</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># The keywords COLOR, OPTIONS, and EIGHTBIT (honored by the</span>
<span style="color: #666666; font-style: italic;"># slackware version of dircolors) are recognized but ignored.</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Below, there should be one TERM entry for each termtype that is colorizable</span>
TERM linux
TERM linux-c
TERM mach-color
TERM console
TERM con132x25
TERM con132x30
TERM con132x43
TERM con132x60
TERM con80x25
TERM con80x28
TERM con80x30
TERM con80x43
TERM con80x50
TERM con80x60
TERM xterm
TERM xterm-color
TERM xterm-debian
TERM rxvt
TERM <span style="color: #c20cb9; font-weight: bold;">screen</span>
TERM screen-w
TERM vt100
&nbsp;
<span style="color: #666666; font-style: italic;"># Below are the color init strings for the basic file types. A color init</span>
<span style="color: #666666; font-style: italic;"># string consists of one or more of the following numeric codes:</span>
<span style="color: #666666; font-style: italic;"># Attribute codes:</span>
<span style="color: #666666; font-style: italic;"># 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed</span>
<span style="color: #666666; font-style: italic;"># Text color codes:</span>
<span style="color: #666666; font-style: italic;"># 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white</span>
<span style="color: #666666; font-style: italic;"># Background color codes:</span>
<span style="color: #666666; font-style: italic;"># 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white</span>
NORMAL 00	<span style="color: #666666; font-style: italic;"># global default, although everything should be something.</span>
FILE 00 	<span style="color: #666666; font-style: italic;"># normal file</span>
DIR 01;<span style="color: #000000;">36</span> 	<span style="color: #666666; font-style: italic;"># directory</span>
LINK 01;<span style="color: #000000;">37</span> 	<span style="color: #666666; font-style: italic;"># symbolic link.  (If you set this to 'target' instead of a</span>
           	<span style="color: #666666; font-style: italic;"># numerical value, the color is as for the file pointed to.)</span>
FIFO <span style="color: #000000;">40</span>;<span style="color: #000000;">33</span>	<span style="color: #666666; font-style: italic;"># pipe</span>
SOCK 01;<span style="color: #000000;">35</span>	<span style="color: #666666; font-style: italic;"># socket</span>
DOOR 01;<span style="color: #000000;">35</span>	<span style="color: #666666; font-style: italic;"># door</span>
BLK <span style="color: #000000;">40</span>;<span style="color: #000000;">33</span>;01	<span style="color: #666666; font-style: italic;"># block device driver</span>
CHR <span style="color: #000000;">40</span>;<span style="color: #000000;">33</span>;01 	<span style="color: #666666; font-style: italic;"># character device driver</span>
ORPHAN <span style="color: #000000;">40</span>;<span style="color: #000000;">31</span>;01 <span style="color: #666666; font-style: italic;"># symlink to nonexistent file</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># This is for files with execute permission:</span>
EXEC 01;<span style="color: #000000;">35</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># List any file extensions like '.gz' or '.tar' that you would like ls</span>
<span style="color: #666666; font-style: italic;"># to colorize below. Put the extension, a space, and the color init string.</span>
<span style="color: #666666; font-style: italic;"># (and any comments you want to add after a '#')</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># If you use DOS-style suffixes, you may want to uncomment the following:</span>
<span style="color: #666666; font-style: italic;">#.cmd 01;32 # executables (bright green)</span>
<span style="color: #666666; font-style: italic;">#.exe 01;32</span>
<span style="color: #666666; font-style: italic;">#.com 01;32</span>
<span style="color: #666666; font-style: italic;">#.btm 01;32</span>
<span style="color: #666666; font-style: italic;">#.bat 01;32</span>
&nbsp;
.tar 01;<span style="color: #000000;">31</span> <span style="color: #666666; font-style: italic;"># archives or compressed (bright red)</span>
.tgz 01;<span style="color: #000000;">31</span>
.arj 01;<span style="color: #000000;">31</span>
.taz 01;<span style="color: #000000;">31</span>
.lzh 01;<span style="color: #000000;">31</span>
.zip 01;<span style="color: #000000;">31</span>
.z   01;<span style="color: #000000;">31</span>
.Z   01;<span style="color: #000000;">31</span>
.gz  01;<span style="color: #000000;">31</span>
.bz2 01;<span style="color: #000000;">31</span>
.deb 01;<span style="color: #000000;">31</span>
.rpm 01;<span style="color: #000000;">31</span>
.jar 01;<span style="color: #000000;">31</span>
.dmg 01;<span style="color: #000000;">31</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># image formats</span>
.jpg 01;<span style="color: #000000;">35</span>
.png 01;<span style="color: #000000;">35</span>
.gif 01;<span style="color: #000000;">35</span>
.bmp 01;<span style="color: #000000;">35</span>
.ppm 01;<span style="color: #000000;">35</span>
.tga 01;<span style="color: #000000;">35</span>
.xbm 01;<span style="color: #000000;">35</span>
.xpm 01;<span style="color: #000000;">35</span>
.tif 01;<span style="color: #000000;">35</span>
.png 01;<span style="color: #000000;">35</span>
.mpg 01;<span style="color: #000000;">35</span>
.avi 01;<span style="color: #000000;">35</span>
.fli 01;<span style="color: #000000;">35</span>
.gl 01;<span style="color: #000000;">35</span>
.dl 01;<span style="color: #000000;">35</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># source code files</span>
.pl 00;<span style="color: #000000;">33</span>
.PL 00;<span style="color: #000000;">33</span>
.pm 00;<span style="color: #000000;">33</span>
.tt 00;<span style="color: #000000;">33</span>
.yml 00;<span style="color: #000000;">33</span>
.sql 00;<span style="color: #000000;">33</span>
.html 00;<span style="color: #000000;">33</span>
.css 00;<span style="color: #000000;">33</span>
.js 00;<span style="color: #000000;">33</span></pre></td></tr></table></div>


<p>Finally, all you need to do is close and re-open the Terminal.  Now we should be sorted. <img src='http://hocuspokus.net/wp-content/plugins/smilies-themer/tango/face-smile.png' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://hocuspokus.net/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fhocuspokus.net%2F2008%2F01%2Fa-better-ls-for-mac-os-x&amp;seed_title=A+Better+Ls+for+Mac+OS%26%23160%3BX/feed</wfw:commentRss>
		<slash:comments>42</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->