<?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>Sprayfly &#187; Linux</title>
	<atom:link href="http://sprayfly.com/tag/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://sprayfly.com</link>
	<description>Languages, Linux, Life</description>
	<lastBuildDate>Wed, 14 Jul 2010 03:32:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Type Chinese Pinyin Accents in Ubuntu</title>
		<link>http://sprayfly.com/2010/06/23/type-chinese-pinyin-accents-in-ubuntu/</link>
		<comments>http://sprayfly.com/2010/06/23/type-chinese-pinyin-accents-in-ubuntu/#comments</comments>
		<pubDate>Wed, 23 Jun 2010 22:17:53 +0000</pubDate>
		<dc:creator>Jono</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[ibus]]></category>
		<category><![CDATA[pinyin]]></category>
		<category><![CDATA[romanisation]]></category>
		<category><![CDATA[tone]]></category>

		<guid isPermaLink="false">http://sprayfly.com/?p=454</guid>
		<description><![CDATA[Chinese learners or speakers may sometimes want to write out the romanisation for certain chinese characters complete with accents indicating the different tones. For example: 你好 [nǐhǎo] This is possible using the Ibus input framework that comes with Ubuntu. The support for pinyin romanisation is provided in the ibus-m17n package. This must first be installed. [...]]]></description>
			<content:encoded><![CDATA[<p>Chinese learners or speakers may sometimes want to write out the romanisation for certain chinese characters complete with accents indicating the different tones. For example:</p>
<p>你好 [nǐhǎo]</p>
<p>This is possible using the Ibus input framework that comes with Ubuntu. The support for pinyin romanisation is provided in the <em>ibus-m17n</em> package. This must first be installed.</p>
<pre>sudo apt-get install ibus-m17n</pre>
<p>Once installed, restart Ibus and add the input method in the menu as in the screenshot below.<br />
<a href="http://www.flickr.com/photos/jonolumb/4728107187/" class="tt-flickr tt-flickr-Medium" title="ibus-pinyin"><img class="aligncenter" src="http://farm2.static.flickr.com/1251/4728107187_b9c199f0d1.jpg" alt="ibus-pinyin" width="401" height="500" /></a> </p>
<p>You should now be able to activate the input method. Simply type the pinyin for a character preceded by the tone number (ranging from 1 to 4).</p>
<div id="mainphotoarea"></div>]]></content:encoded>
			<wfw:commentRss>http://sprayfly.com/2010/06/23/type-chinese-pinyin-accents-in-ubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fix the &#8220;534 Protection level negotiation failed.&#8221; error in lftp</title>
		<link>http://sprayfly.com/2010/01/15/fix-the-534-protection-level-negotiation-failed-error-in-lftp/</link>
		<comments>http://sprayfly.com/2010/01/15/fix-the-534-protection-level-negotiation-failed-error-in-lftp/#comments</comments>
		<pubDate>Fri, 15 Jan 2010 22:40:59 +0000</pubDate>
		<dc:creator>Jono</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[534]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[ftp]]></category>
		<category><![CDATA[ftpes]]></category>
		<category><![CDATA[leeds]]></category>
		<category><![CDATA[lftp]]></category>
		<category><![CDATA[sftp]]></category>
		<category><![CDATA[ssl]]></category>
		<category><![CDATA[university]]></category>

		<guid isPermaLink="false">http://sprayfly.com/?p=443</guid>
		<description><![CDATA[If you are using lftp to connect to a secure FTP (SFTP) server using SSL, you may sometimes get the following error during file transfers: 534 Protection level negotiation failed. In this case, you need to add the following line to the bottom of your /etc/lftp.conf file set ftp:ssl-protect-data yes Now try connecting again and [...]]]></description>
			<content:encoded><![CDATA[<p>If you are using lftp to connect to a secure FTP (SFTP) server using SSL, you may sometimes get the following error during file transfers:</p>
<pre>534 Protection level negotiation failed.</pre>
<p>In this case, you need to add the following line to the bottom of your /etc/lftp.conf file</p>
<pre>set ftp:ssl-protect-data yes</pre>
<p>Now try connecting again and hopefully everything should work ok &#8211; it sorted my problems when I was trying to connect to the Leeds University SFTP servers using lftp on Ubuntu 9.10 (Karmic).</p>
<div id="mainphotoarea"></div>]]></content:encoded>
			<wfw:commentRss>http://sprayfly.com/2010/01/15/fix-the-534-protection-level-negotiation-failed-error-in-lftp/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>用 tsocks 和 proxychains 使 Linux 下所有软件能够翻墙</title>
		<link>http://sprayfly.com/2009/07/09/%e7%94%a8-tsocks-%e4%bd%bf-linux-%e4%b8%8b%e6%89%80%e6%9c%89%e8%bd%af%e4%bb%b6%e8%83%bd%e5%a4%9f%e7%bf%bb%e5%a2%99/</link>
		<comments>http://sprayfly.com/2009/07/09/%e7%94%a8-tsocks-%e4%bd%bf-linux-%e4%b8%8b%e6%89%80%e6%9c%89%e8%bd%af%e4%bb%b6%e8%83%bd%e5%a4%9f%e7%bf%bb%e5%a2%99/#comments</comments>
		<pubDate>Thu, 09 Jul 2009 05:31:36 +0000</pubDate>
		<dc:creator>Jono</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[china]]></category>
		<category><![CDATA[翻墙]]></category>
		<category><![CDATA[firewall]]></category>
		<category><![CDATA[gfw]]></category>
		<category><![CDATA[gwibber]]></category>
		<category><![CDATA[proxychains]]></category>
		<category><![CDATA[SOCKS]]></category>
		<category><![CDATA[tsocks]]></category>
		<category><![CDATA[封锁]]></category>
		<category><![CDATA[封杀]]></category>

		<guid isPermaLink="false">http://sprayfly.com/?p=403</guid>
		<description><![CDATA[情况 由于最近在中国某个地方爆发了 riot, 所以境内很多网站又是无法访问 (twitter.com、facebook.com 等)，让我们这些网民很无奈。 使用 SSH 翻墙 我曾经介绍过如何使用 SSH 来建立一个 SOCKS 代理服务器，让你能够在 Firefox 里正常访问以上所提起的网址。然而不是所有 Linux 软件都能支持代理服务器。如果你最热爱的 Linux 工具需要访问&#8221;被封&#8221;的网站，又没有嵌入的代理支持，该怎么办呢？ 遇到这种情况当然不要放弃该软件&#8230; 毕竟我们用的系统是 Linux 而不是以前让我们咳声叹气，丧失信心的 Windows，总有一个方法去解决问题。 举个例子吧 我不久前发现了 Twitter 这个网站。我一开始不经常用，也搞不明白别人为什么对这个 web 2.0 服务都着了迷。后来我在推特上跟的人越来越多，跟着我的人亦是日益增多，不知不觉我也迷上了该网站，天天都会上。凡是经常用推特的人一般都会用一个推特的客户端，这才能跟得上朋友们的状态更新和最火热的网络新闻。本人作为 Ubuntu 的用户，我自然就选了 Gwibber 这个基于 GNOME 的客户端来访问我的推特。这个软件功能很丰富，用起来得心应手，不过总有一个问题让我有点遗憾，就是 Gwibber 还不听从 GNOME 的代理设置。平时这也不是一个很大的问题，但是每遇中国网络封锁较严重时，都会让我暂时无法使用该软件。 解决方案&#8230; Tsocks 经过几个 Google 搜索，我最终很高兴地发现 Linux 有一个能够强迫任何软件通过 SOCKS 代理上网的工具，其名就是 tsocks。Tsocks 是一个透明 SOCKS 代理软件，只要你电脑有一个连接到国外服务器的 [...]]]></description>
			<content:encoded><![CDATA[<p><strong>情况</strong><br />
由于最近在中国某个地方爆发了 riot, 所以境内很多网站又是无法访问 (twitter.com、facebook.com 等)，让我们这些网民很无奈。</p>
<p><strong>使用 SSH 翻墙</strong><br />
<a href="http://sprayfly.com/2009/07/05/%E5%9C%A8-linux-%E4%B8%8B%E4%BD%BF%E7%94%A8%E4%BD%A0%E7%9A%84%E7%BD%91%E7%AB%99%E4%B8%BB%E6%9C%BA%E4%BD%9C%E4%B8%BA%E5%8A%A0%E5%AF%86%E4%BB%A3%E7%90%86%E6%9C%8D%E5%8A%A1%E5%99%A8/">我曾经介绍过</a>如何使用 SSH 来建立一个 SOCKS 代理服务器，让你能够在 Firefox 里正常访问以上所提起的网址。然而不是所有 Linux 软件都能支持代理服务器。如果你最热爱的 Linux 工具需要访问&#8221;被封&#8221;的网站，又没有嵌入的代理支持，该怎么办呢？<br />
遇到这种情况当然不要放弃该软件&#8230; 毕竟我们用的系统是 Linux 而不是以前让我们咳声叹气，丧失信心的 Windows，总有一个方法去解决问题。</p>
<p><strong>举个例子吧</strong><br />
我不久前发现了 Twitter 这个网站。我一开始不经常用，也搞不明白别人为什么对这个 web 2.0 服务都着了迷。后来我在推特上跟的人越来越多，跟着我的人亦是日益增多，不知不觉我也迷上了该网站，天天都会上。凡是经常用推特的人一般都会用一个推特的客户端，这才能跟得上朋友们的状态更新和最火热的网络新闻。本人作为 Ubuntu 的用户，我自然就选了 <a href="https://launchpad.net/gwibber">Gwibber</a> 这个基于 GNOME 的客户端来访问我的推特。这个软件功能很丰富，用起来得心应手，不过总有一个问题让我有点遗憾，就是 Gwibber <a href="https://bugs.launchpad.net/gwibber/+bug/259830">还不听从 GNOME 的代理设置</a>。平时这也不是一个很大的问题，但是每遇中国网络封锁较严重时，都会让我暂时无法使用该软件。</p>
<p><strong>解决方案&#8230; Tsocks</strong><br />
经过几个 Google 搜索，我最终很高兴地发现 Linux 有一个能够强迫任何软件通过 SOCKS 代理上网的工具，其名就是 tsocks。Tsocks 是一个透明 SOCKS 代理软件，只要你电脑有一个<a href="http://sprayfly.com/2009/07/05/%E5%9C%A8-linux-%E4%B8%8B%E4%BD%BF%E7%94%A8%E4%BD%A0%E7%9A%84%E7%BD%91%E7%AB%99%E4%B8%BB%E6%9C%BA%E4%BD%9C%E4%B8%BA%E5%8A%A0%E5%AF%86%E4%BB%A3%E7%90%86%E6%9C%8D%E5%8A%A1%E5%99%A8/">连接到国外服务器的 SSH 隧道</a>，你就能让任何软件翻墙。</p>
<p><strong>安装并配置 Tsocks</strong><br />
以下说明都是为了那些使用 Ubuntu  的 Linux 用户，不过在别的 Linux 发行版下，安装的过程应该与此差不多。</p>
<p>在终端中:</p>
<pre>sudo apt-get install tsocks</pre>
<p>修改配置文件:</p>
<pre>sudo nano /etc/tsocks.conf</pre>
<p>将其内容改成以下几行并保存退出:</p>
<pre>local = 192.168.1.0/255.255.255.0 #local表示本地的网络，也就是不使用socks代理的网络
server = 127.0.0.1 # SOCKS 服务器的 IP
server_type = 5 # SOCKS 服务版本
server_port = 9999 ＃SOCKS 服务使用的端口</pre>
<p>你可能需要修改一下以上内容，用你自己的 SSH 隧道设置。</p>
<p><strong>运行软件</strong><br />
用 tsocks 运行你的软件很简单，在终端中:</p>
<pre>tsocks 你的软件 &#038;</pre>
<p>我现在运行 Gwibber 都是这样运行的:</p>
<pre>tsocks gwibber &#038;</pre>
<p>祝你们翻墙愉快！</p>
<p><strong>EDIT&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;></strong></p>
<p>我今天还发现了另外一个工具，其功能似乎比 tsocks 要更丰富，配置起来更简单，而且不会那么容易出错。这个工具就是 <a href="proxychains.sourceforge.net/">proxychains</a>。以下有配置方法:</p>
<pre>sudo apt-get install proxychains</pre>
<p>修改配置文件 (/etc/proxychains.conf)，应该如下：</p>
<pre># proxychains.conf  VER 2.0
#
#        HTTP, SOCKS4, SOCKS5 tunneling proxifier.
#

# The option below identifies how the ProxyList is treated.
# only one option should be uncommented at time,
# otherwise the last appearing option will be accepted
#
# Dynamic - Each connection will be done via chained proxies
# all proxies chained in the order as they appear in the list
# at least one proxy must be online to play in chain
# (dead proxies are skipped)
# otherwise EINTR is returned to the app
#
# Strict - Each connection will be done via chained proxies
# all proxies chained in the order as they appear in the list
# all proxies must be online to play in chain
# otherwise EINTR is returned to the app
#
# Random - Each connection will be done via random proxy
# (or proxy chain, see  chain_len) from the list
# this option is good for scans

dynamic_chain
#strict_chain
#random_chain

# Make sense only if random_chain
chain_len = 2

# Quiet mode (no output)
#quiet_mode

# Write stats about good proxies to proxychains.stats
#write_stats

#Some timeouts in milliseconds
#
tcp_read_time_out 15000
tcp_connect_time_out 10000

[ProxyList]
# ProxyList format
#       type  host  port [user pass]
#       (values separated by 'tab' or 'blank')
#
#
#        Examples:
#
#            	socks5	192.168.67.78	1080	lamer  secret
#		http	192.168.89.3	8080	justu	hidden
#	 	socks4	192.168.1.49	1080
#	        http	192.168.39.93	8080
#
#
#       proxy types: http, socks4, socks5
#        ( auth types supported: "basic"-http  "user/pass"-socks )
#
#http 	10.0.0.5 3128
socks5 127.0.0.1 9999
socks4 127.0.0.1 9050
</pre>
<p>注意事项:</p>
<ol>
<li>要选 dynamic_chain 而不是 random_chain</li>
<li>可以列举几个代理服务器，proxychains  会按顺序用，代理无法访问即自动选用下一个</li>
<li>代理服务器要根据自己电脑的情况自行调整</li>
</ol>
<p><strong>运行 proxychains</strong><br />
运行 proxychains 跟运行 tsocks 完全一样。在终端中:</p>
<pre>proxychains 你的软件 &#038;</pre>
<p>比如说:</p>
<pre>proxychains chromium-browser &#038;</pre>
<p>我还是推荐你使用 proxychains！</p>
<div id="mainphotoarea"></div>]]></content:encoded>
			<wfw:commentRss>http://sprayfly.com/2009/07/09/%e7%94%a8-tsocks-%e4%bd%bf-linux-%e4%b8%8b%e6%89%80%e6%9c%89%e8%bd%af%e4%bb%b6%e8%83%bd%e5%a4%9f%e7%bf%bb%e5%a2%99/feed/</wfw:commentRss>
		<slash:comments>55</slash:comments>
		</item>
		<item>
		<title>在 Linux 下使用你的网站主机作为加密代理服务器</title>
		<link>http://sprayfly.com/2009/07/05/%e5%9c%a8-linux-%e4%b8%8b%e4%bd%bf%e7%94%a8%e4%bd%a0%e7%9a%84%e7%bd%91%e7%ab%99%e4%b8%bb%e6%9c%ba%e4%bd%9c%e4%b8%ba%e5%8a%a0%e5%af%86%e4%bb%a3%e7%90%86%e6%9c%8d%e5%8a%a1%e5%99%a8/</link>
		<comments>http://sprayfly.com/2009/07/05/%e5%9c%a8-linux-%e4%b8%8b%e4%bd%bf%e7%94%a8%e4%bd%a0%e7%9a%84%e7%bd%91%e7%ab%99%e4%b8%bb%e6%9c%ba%e4%bd%9c%e4%b8%ba%e5%8a%a0%e5%af%86%e4%bb%a3%e7%90%86%e6%9c%8d%e5%8a%a1%e5%99%a8/#comments</comments>
		<pubDate>Sun, 05 Jul 2009 08:18:54 +0000</pubDate>
		<dc:creator>Jono</dc:creator>
				<category><![CDATA[Site News]]></category>
		<category><![CDATA[网站]]></category>
		<category><![CDATA[网络]]></category>
		<category><![CDATA[翻墙]]></category>
		<category><![CDATA[脚本]]></category>
		<category><![CDATA[gfw]]></category>
		<category><![CDATA[host]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[tunnel]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[服务器]]></category>
		<category><![CDATA[代理]]></category>

		<guid isPermaLink="false">http://sprayfly.com/?p=331</guid>
		<description><![CDATA[我曾经介绍过如何使用 Amazon EC2 建立自己的代理服务器来“翻墙“。用这个方法翻墙虽然网速很快，但还是有些缺点。Amazon EC2 是收费的，而且按小时算，所以不能随时都开着我的代理服务器。另外，每次想用代理的时候还得先等一两分钟，让服务器启动。 然而我今天看到了这个贴子，这才发现还可以使用一个普通的网站主机作为我的代理服务器。与 Amazon EC2 不同，普通的网站主机是 24/7 运行的，而且你本来就要用它做你的网站，不用额外花钱。以上帖子是专门写给使用 Dreamhost 的 Windows 用户。不过，凡是有支持 SSH 服务网站主机的 Linux 用户也可以享受翻墙的自由感。我为 Linux 用户编了一个小的 BASH 脚本，其主要功能为: 与网站主机创建一个 SSH 隧道连接 SSH 隧道用完之后，安全地关闭 SSH 隧道连接 用这个脚本，我试了一下上平时被 GFW 封杀的 youtube.com&#8230; 结果 Firefox 差点让我晕倒了! 用这个代理，网速快极了&#8230; 感觉好像我还在英国上网似的 (那边一般都用 8M 以上的宽带) &#8211; 你可以看一下视频: 介绍一下脚本的内容 export SSH_HOST=admin@yoursite.com # username@host 这个需要你自己改一下&#8230; 就是你的 webhost 给你的 SSH [...]]]></description>
			<content:encoded><![CDATA[<p>我<a href="http://sprayfly.com/2009/06/28/shell-script-for-automated-amazon-ec2-personal-proxy-server/">曾经介绍过</a>如何使用 Amazon EC2 建立自己的代理服务器来“翻墙“。用这个方法翻墙虽然网速很快，但还是有些缺点。Amazon EC2 是收费的，而且按小时算，所以不能随时都开着我的代理服务器。另外，每次想用代理的时候还得先等一两分钟，让服务器启动。</p>
<p>然而我今天看到了这个<a href="http://www.fishnote.net/?p=86">贴子</a>，这才发现还可以使用一个普通的网站主机作为我的代理服务器。与 Amazon EC2 不同，普通的网站主机是 24/7 运行的，而且你本来就要用它做你的网站，不用额外花钱。以上帖子是专门写给使用 Dreamhost 的 Windows 用户。不过，凡是有支持 SSH 服务网站主机的 Linux 用户也可以享受翻墙的自由感。我为 Linux 用户编了一个小的 BASH 脚本，其主要功能为:</p>
<ul>
<li>与网站主机创建一个 SSH 隧道连接</li>
<li>SSH 隧道用完之后，安全地关闭 SSH 隧道连接</li>
</ul>
<p>用这个脚本，我试了一下上平时被 GFW 封杀的 youtube.com&#8230; 结果 Firefox 差点让我晕倒了! 用这个代理，网速快极了&#8230; 感觉好像我还在英国上网似的 (那边一般都用 8M 以上的宽带) &#8211; 你可以看一下视频:</p>
<p><object width="400" height="250" style="display: block; margin-left: auto; margin-right: auto;"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=5468249&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=5468249&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="250"></embed></object></p>
<p><strong>介绍一下脚本的内容</strong></p>
<pre>export SSH_HOST=admin@yoursite.com # username@host</pre>
<p>这个需要你自己改一下&#8230; 就是你的 webhost 给你的 SSH 用户名和主机地址。 格式为 用户名@地址 （凡是用过 SSH 的人都应该知道写什么）</p>
<pre>if [ ! -f /tmp/.tunnel ]</pre>
<p>看看是否已经有 SSH 隧道开着。有的话就将其关闭。没有就创建新的 SSH 隧道。</p>
<pre>ssh -f -D 9999 $SSH_HOST "if [ -f ~/.tunnel ]; then rm ~/.tunnel; fi; while [ ! -f ~/.tunnel ]; do echo > /dev/null; done" &#038;</pre>
<p>创建新的 SSH 隧道，设定本地 SOCKS 端口为 9999。隧道将会开着直到远程目录 “~/” 里有人创建 .tunnel 此文件为止。</p>
<pre>touch /tmp/.tunnel</pre>
<p>在你的电脑上创建 .tunnel 这个文件。这样脚本就知道正开着一个 SSH 隧道。</p>
<pre>ssh $SSH_HOST "touch ~/.tunnel"</pre>
<p>在远程目录 “~/&#8221; 里创建 .tunnel 此文件，这将会断开你电脑与代理服务器的连接</p>
<pre>rm /tmp/.tunnel</pre>
<p>删除 .tunnel 这个文件。这样脚本就知道 SSH 隧道已关闭。</p>
<p><strong>下载并执行脚本</strong><br />
<a href="http://files.getdropbox.com/u/316115/tunnel.sh">可以在此下载脚本</a></p>
<p>下载后放在你的首目录，比如在 ~/bin/。用一个文字编辑器修改脚本里的 ssh 变量并用 chmod 改一下文件权限</p>
<pre>chmod u+x tunnel.sh</pre>
<p><strong>创建连接</strong><br />
在终端中执行脚本，执行后可以关闭终端。</p>
<p><a href="http://www.flickr.com/photos/jonolumb/3689649442/" class="tt-flickr tt-flickr-Medium" title="open_tunnel.png"><img class="alignnone" src="http://farm3.static.flickr.com/2544/3689649442_9dd0cbe710.jpg" alt="open_tunnel.png" width="500" height="335" /></a></p>
<p><strong>关闭连接</strong><br />
再次在终端中执行脚本并关闭 Firefox (如果 Firefox 还在用隧道的话，连接暂时无法关闭)</p>
<p> <a href="http://www.flickr.com/photos/jonolumb/3688843963/" class="tt-flickr tt-flickr-Medium" title="close_tunnel.png"><img class="alignnone" src="http://farm4.static.flickr.com/3640/3688843963_8fdffbed01.jpg" alt="close_tunnel.png" width="500" height="335" /></a></p>
<p><strong>用 SSH 密钥进行授权</strong><br />
你或许注意到了&#8230; 以上脚本里没有任何地方可以写下你的 SSH 密码。这就是因为我在用 SSH 密钥来进行电脑与服务器的授权工作，这样更自动化而且比将密码直接写入文本的文件里要安全多了。先打开一个终端，根据一下步骤进行密钥配置:</p>
<pre>[jonolumb@jonoxps .ssh]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/jonolumb/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/jonolumb/.ssh/id_rsa
Your public key has been saved in /home/jonolumb/.ssh/id_rsa.pub
The key fingerprint is:
h7:10:49:46:ab:2t:3b:a3:36:2z:15:56:d4:f2:b7:3d jonolumb@jonoxps</pre>
<p>请注意，配置时密码要留为空白。</p>
<p>将生成的 /home/jonolumb/.ssh/id_rsa.pub 的内容复制到远程服务器目录下，具体位置是:<br />
~/.ssh/authorized_keys<br />
要保证远程的 authorized_keys 和 本地的 id_rsa 文件的权限均为 700。<br />
这样就可以自动登录到远程服务器了。</p>
<p><strong>配置 Firefox 使用代理</strong><br />
创建了 SSH 隧道之后，就进入 Firefox 并打开:</p>
<pre>首选项 --> 高级 --> 连接设置</pre>
<p>选择“手动配置代理”并将其设定为:<br />
HTTP 代理: localhost 端口: 9999</p>
<p> <a href="http://www.flickr.com/photos/jonolumb/3689657500/" class="tt-flickr tt-flickr-Medium" title="firefox_proxy.png"><img class="alignnone" src="http://farm3.static.flickr.com/2536/3689657500_4c7c03d871.jpg" alt="firefox_proxy.png" width="488" height="500" /></a></p>
<p>如果你用这个脚本遇到什么问题，请跟我取得联系。我很想听你们的意见。谢谢！</p>
<div id="mainphotoarea"></div>]]></content:encoded>
			<wfw:commentRss>http://sprayfly.com/2009/07/05/%e5%9c%a8-linux-%e4%b8%8b%e4%bd%bf%e7%94%a8%e4%bd%a0%e7%9a%84%e7%bd%91%e7%ab%99%e4%b8%bb%e6%9c%ba%e4%bd%9c%e4%b8%ba%e5%8a%a0%e5%af%86%e4%bb%a3%e7%90%86%e6%9c%8d%e5%8a%a1%e5%99%a8/feed/</wfw:commentRss>
		<slash:comments>55</slash:comments>
		</item>
		<item>
		<title>Gnome-Do 0.8.2 released &#8211; New features and plenty of improvements</title>
		<link>http://sprayfly.com/2009/06/30/gnome-do-0-8-2-released-new-features-and-plenty-of-improvements/</link>
		<comments>http://sprayfly.com/2009/06/30/gnome-do-0-8-2-released-new-features-and-plenty-of-improvements/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 13:29:31 +0000</pubDate>
		<dc:creator>Jono</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[0.8.2]]></category>
		<category><![CDATA[do]]></category>
		<category><![CDATA[dock]]></category>
		<category><![CDATA[docklets]]></category>
		<category><![CDATA[docky]]></category>
		<category><![CDATA[gnome-do]]></category>
		<category><![CDATA[graphics]]></category>
		<category><![CDATA[intellihide]]></category>
		<category><![CDATA[launcher]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[release]]></category>
		<category><![CDATA[ui]]></category>

		<guid isPermaLink="false">http://sprayfly.com/?p=284</guid>
		<description><![CDATA[A new version of Gnome-Do was released today &#8211; 0.8.2. However, don&#8217;t be deceived by the small change in version number, this new release contains plenty of new features as well as squashing quite a few bugs along the way. Here is a brief summary of some of the changes I&#8217;m aware of. Docky &#8216;Intellihide&#8217; [...]]]></description>
			<content:encoded><![CDATA[<p>A new version of Gnome-Do was released today &#8211; <strong>0.8.2</strong>. However, don&#8217;t be deceived by the small change in version number, this new release contains plenty of new features as well as squashing quite a few bugs along the way. Here is a brief summary of some of the changes I&#8217;m aware of.</p>
<p><a href="http://www.flickr.com/photos/jonolumb/3674546231/" class="tt-flickr tt-flickr-Medium" title="docky.png"><img class="alignnone" src="http://farm4.static.flickr.com/3163/3674546231_0a956615f0.jpg" alt="docky.png" width="500" height="313" /></a> </p>
<p><strong>Docky &#8216;Intellihide&#8217; Feature</strong><br />
Previously when using Docky at the bottom of the screen, you had two options. You could either have the dock open permanently or you could enable the auto-hide feature. Having the dock there permanently certainly facilitates speedy opening of programs but in reality, it is hardly ideal &#8211; what with it getting in the way of all your windows and not allowing you to click on anything at the bottom of the screen. The autohide option is probably the way most people went &#8211; but this means that the dock is never visible until you drag the mouse pointer down to the bottom of the screen &#8211; which makes opening programs using the dock rather cumbersome.</p>
<p><a href="http://www.flickr.com/photos/jonolumb/3674469540/" class="tt-flickr tt-flickr-Medium" title="intellihide.png"><img class="alignnone" src="http://farm4.static.flickr.com/3571/3674469540_7896f165d9.jpg" alt="intellihide.png" width="448" height="500" /></a> </p>
<p>This contradiction has now been resolved with a new feature called &#8216;intellihide&#8217;. If selected, the dock will automatically hide itself when there are full screen programs open on the desktop or when windows are too near the bottom of the screen. However, Docky can still be accessed at all times by dragging the mouse down to the bottom of the desktop. If no programs are open on the desktop and nothing is blocking the bottom of the screen, Docky  will pop back up again and stay at the bottom of your screen allowing you fast, easy access to your most used programs when you need them.</p>
<p><strong>Docky Top and Bottom Orientation</strong><br />
Whilst previously Docky could only be placed at the bottom of your screen, you can now have your favourite dock floating around at the top of your screen now &#8211; giving you even more possibilities for desktop customisation.</p>
<p><a href="http://www.flickr.com/photos/jonolumb/3675322002/" class="tt-flickr tt-flickr-Medium" title="top"><img class="alignnone" src="http://farm3.static.flickr.com/2670/3675322002_6af9433f53.jpg" alt="top" width="500" height="313" /></a> </p>
<p><strong>Improved Flickr Uploading</strong><br />
The Flickr upload plugin now provides more feedback on upload progress. Unlike previously where there would simply be a Gnome-Do icon displayed in the system tray, the Flickr uploader now has it&#8217;s own window and tells you when the upload has completed successfully.</p>
<p><a href="http://www.flickr.com/photos/jonolumb/3674482806/" class="tt-flickr tt-flickr-Medium" title="uploaded.png"><img class="alignnone" src="http://farm4.static.flickr.com/3381/3674482806_92739d16fc.jpg" alt="uploaded.png" width="425" height="178" /></a> </p>
<p><strong>Better UI and Graphics Perfomance</strong><br />
Your mileage may vary depending on what hardware and drivers you are using but I have noticed that the dock animations seem much smoother than before. Furthermore, there are some lovely coloured lighting effects on dock icons for the application which is active in the current window. You can now also change the zoom and icon size settings with sliders rather than dragging &#8220;handles&#8221; on the dock itself.</p>
<p><a href="http://www.flickr.com/photos/jonolumb/3674512161/" class="tt-flickr tt-flickr-Medium" title="active_window"><img class="alignnone" src="http://farm4.static.flickr.com/3115/3674512161_ce8c3cea3d.jpg" alt="active_window" width="433" height="138" /></a> </p>
<p><strong>Docklets</strong><br />
I&#8217;ve tried installing this feature with:</p>
<pre>sudo apt-get install gnome-do-docklets</pre>
<p>But it says that it can&#8217;t find this package or something along those lines. It sounds like an exciting feature but I&#8217;ll have to wait until I can get it working before I can provide more details. All I can find at the moment is information about a nifty looking Weather Docklet which is <a href="http://do.davebsd.com/wiki/Weather_Docklet">documented on the Do Wiki</a>.</p>
<p>Apart from the things I mentioned above, there are now a lot of new plugins available for Gnome-Do and localisation is better than before &#8211; with most of the program and some plugins now available in other languages.  There are probably plenty of other things that have so far gone unnoticed so please leave me a message in the comments if I missed anything important. </p>
<p><a href="http://www.flickr.com/photos/jonolumb/3673682189/" class="tt-flickr tt-flickr-Medium" title="chinese_interface.png"><img class="alignnone" src="http://farm4.static.flickr.com/3600/3673682189_8a8b1f8f1f.jpg" alt="chinese_interface.png" width="454" height="219" /></a> </p>
<div id="mainphotoarea"></div>]]></content:encoded>
			<wfw:commentRss>http://sprayfly.com/2009/06/30/gnome-do-0-8-2-released-new-features-and-plenty-of-improvements/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Shell script for automated Amazon EC2 personal proxy server</title>
		<link>http://sprayfly.com/2009/06/28/shell-script-for-automated-amazon-ec2-personal-proxy-server/</link>
		<comments>http://sprayfly.com/2009/06/28/shell-script-for-automated-amazon-ec2-personal-proxy-server/#comments</comments>
		<pubDate>Sun, 28 Jun 2009 07:04:35 +0000</pubDate>
		<dc:creator>Jono</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[amazon]]></category>
		<category><![CDATA[automated]]></category>
		<category><![CDATA[aws]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[网络]]></category>
		<category><![CDATA[ec2]]></category>
		<category><![CDATA[脚本]]></category>
		<category><![CDATA[instance]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[terminal]]></category>
		<category><![CDATA[代理]]></category>

		<guid isPermaLink="false">http://sprayfly.com/?p=267</guid>
		<description><![CDATA[Scenario I am currently living in China and as many of you know, access to the web here is filtered, meaning sites such as YouTube, Flickr, Blogger, WordPress are often unavailable. Whilst previously I overcame this problem by using TOR and FoxyProxy and setting up rules telling Firefox which URLs should be redirected through the [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Scenario</strong><br />
I am currently living in China and as many of you know, access to the web here is filtered, meaning sites such as YouTube, Flickr, Blogger, WordPress are often unavailable. Whilst previously I overcame this problem by using <a href="www.torproject.org/">TOR</a> and <a href="foxyproxy.mozdev.org/">FoxyProxy</a> and setting up rules telling Firefox which URLs should be redirected through the proxy, TOR is not exactly speedy and so although this setup was free, it was not really suitable for smooth viewing of any blocked multimedia websites.</p>
<p><strong>Solutions</strong><br />
I started to look around for other possible proxy solutions but most pay-for proxies are charged on a monthly basis and are fairly expensive. Furthermore, there is always the possibility that the authorities here are already aware of the IP ranges of some commercial proxy servers and so you run the risk of being blocked out yet again. What I really needed was a pay as you go proxy server where you would only be charged when you actually use the server and for the amount of bandwidth used. I then came accross <a href="http://www.duanestorey.com/2009/06/help-iran-with-a-proxy-server/">a post on Duane Storey&#8217;s blog</a> which described how he created an Amazon EC2 instance which could be used to make a proxy server available that was only to Iranian web users. Duane&#8217;s solution involves his own custom Fedora image which has Apache setup to run as a web proxy. This setup was pretty much exactly what I needed &#8211; except that I would need to make sure the Proxy server only allowed my own computer to connect rather than making it a public proxy server accessible to Iranians. After a bit of testing, I managed to get something going and was pleased to see that the proxy was very speedy indeed!</p>
<p><strong>Cheap Proxy Server</strong><br />
Amazon EC2 Instances currently cost $0.10 USD per hour to run plus bandwidth charges (which for standard web browsing will be negligent). This gives Amazon EC2 the potential to be an incredibly cheap on-demand proxy server. Finally you only pay for what you use rather than paying an extortionate monthly rate.</p>
<p><strong>Automation</strong><br />
The next thing to do was to automate the server setup process as entering all the necessary commands into a terminal can be cumbersome and time consuming. I used a unix shell script to accomplish the following steps:</p>
<ol>
<li>Create an Amazon EC2 Fedora instance which is configured to run Apache as a proxy server.</li>
<li>Connect to Amazon EC2 instance via SSH and modify the Apache configuration file to only allow the client&#8217;s computer to connect to the server.</li>
<li>Restart Apache to apply changes.</li>
<li>(Optional) Assign an Amazon Elastic IP Address to the Instance which can be used to access the HTTP Proxy. The script prints the IP address assigned to the proxy server in the terminal &#8211; this IP address can then be pasted into your web browsers proxy configuration settings.</li>
<li>(Optional) Create a secure SSH HTTP Tunnel to the proxy server on port 9999. Clients can connect by changing browser network settings to a SOCKS 5 proxy on localhost:9999.</li>
<li>The script then waits for keyboard input &#8220;stop&#8221; upon which the SSH HTTP tunnel will be closed, the Amazon EC2 Instance shutdown and any Amazon Elastic IP addresses released.</li>
</ol>
<p>The script is designed to work on Ubuntu (Jaunty 9.04) but should also work on other Linux Operating Systems and possibly on Mac OS X too. Before you can get it up and running there is some preliminary preparation which is necessary.</p>
<p><strong>Step 1: Sign up for an account and setup AWS</strong><br />
Before you can use Amazon Web Services, you need to sign up for an account at <a href="http://aws.amazon.com/">http://aws.amazon.com/</a>.</p>
<p>This will give you two keys that you will need for accessing your Amazon Web Services: your &#8220;access key&#8221; and your &#8220;secret access key&#8221;. Once complete, you then need to sign up for Amazon&#8217;s Elastic Compute Cloud (EC2) service. As part of signing up for EC2, you will create an X.509 certificate. You will need to save your private and public keys in ~/.ec2 on your local machine. All this is described in more detail in the AWS &#8220;Getting Started Guide&#8221; under <a href="http://docs.amazonwebservices.com/AWSEC2/2008-05-05/GettingStartedGuide/index.html?account.html">Setting up an account</a>.</p>
<p><strong>Step 2: Download and install EC2 command line tools</strong><br />
The process of setting up the tools is described under Setting up the Tools in AWS &#8220;<a href="http://docs.amazonwebservices.com/AWSEC2/2008-05-05/GettingStartedGuide/index.html?setting-up-your-tools.html">Getting Started Guide</a>&#8220;. Just do what that page says and note down the location of the tools directory.</p>
<p><strong>Step 3: Generate an SSH keypair, disable strict key checking</strong><br />
Follow the instructions <a href="http://docs.amazonwebservices.com/AWSEC2/2008-05-05/GettingStartedGuide/running-an-instance.html#generating-a-keypair">here</a> to generate an SSH keypair to be used in combination with your Amazon EC2 Instance. The RSA private key generated needs to be placed in your ~/.ssh folder and should be given 600 permissions.</p>
<pre>chmod 600 your_rsa_key</pre>
<p>Another important thing for the script to work is to set OpenSSH to disable Strict Host Key Checking for amazon domains only. This has only minor security implications and is vital if you want the whole server setup process to be automated.</p>
<p>In ~/.ssh/ create a file called <em>config</em> and put the following text inside:</p>
<pre>Host *.amazonaws.com
StrictHostKeyChecking false</pre>
<p>Give the file the right permissions</p>
<pre>chmod 600 ~/.ssh/config</pre>
<p>Finally, you need to open up ports in the EC2 firewall to allow SSH connections to the server instance that is created by the script. This can be done with the following command from the EC2 command line tools:</p>
<pre>ec2-authorize default -p 22</pre>
<p><strong>Step 4: Install Curl</strong><br />
The shell script uses a command line utility called curl to determine the external IP address of your computer &#8211; hence allowing you exclusively to connect to the proxy server. On Ubuntu, curl can be installed using apt-get.</p>
<pre>sudo apt-get install curl</pre>
<p><strong>Step 6: Download the script and configure variables</strong><br />
First <a href="http://files.getdropbox.com/u/316115/autoproxy.tar.gz">download the autoproxy archive</a> to somewhere in your home folder and uncompress it. You then need to make the shell script executable </p>
<pre>chmod u+x autoproxy.sh</pre>
<p>Open the file in a text editor and make changes to the below variables to fit your own setup:</p>
<pre>export EC2_HOME=/home/username/folder/ec2</pre>
<p>This is the location of the EC2 command line tools which were installed during Step 2.</p>
<pre>export EC2_PRIVATE_KEY=~/.ec2/pk-LSOEEFCT2IYW74BHFUIHHSBE63H4GM77.pem</pre>
<p>This is the location of your Amazon EC2 Private Key file which you generated when creating your AWS account.</p>
<pre>export EC2_CERT=~/.ec2/cert-LSOEEFCT2IYW74BHFUIHHSBE63H4GM77.pem</pre>
<p>This is the location of your Amazon EC2 Certificate file which you generated when creating your AWS account.</p>
<pre>export JAVA_HOME=/usr/lib/jvm/java-6-sun/jre</pre>
<p>Location of Java on your computer.</p>
<p>If you don&#8217;t know where Java is installed on your computer you can follow symbolic links in a terminal to find it:</p>
<pre>ls -l /usr/bin/java</pre>
<p><strong>/usr/bin/java -> /etc/alternatives/java</strong></p>
<pre>ls -l /etc/alternatives/java</pre>
<p><strong>/etc/alternatives/java -> /usr/lib/jvm/java-6-sun/jre/bin/java</strong></p>
<pre>export ssh_key=~/.ssh/id_rsa-gsg-keypair</pre>
<p>Location of your Amazon EC2 SSH private RSA key (created in Step 3). This should be located in ~/.ssh and needs 600 permissions.</p>
<pre>export autoproxy=/home/username/autoproxy</pre>
<p>Location of the autoproxy folder that you downloaded.</p>
<p><strong>Running the script</strong><br />
To run the script, open up a terminal and type the following:</p>
<pre>cd /home/*username*/autoproxy/
./autoproxy.sh</pre>
<p><a href="http://www.flickr.com/photos/jonolumb/3666810101/" class="tt-flickr tt-flickr-Medium" title="autoproxy.png"><img class="alignnone" src="http://farm4.static.flickr.com/3306/3666810101_7f9b22c7a7.jpg" alt="autoproxy.png" width="500" height="395" /></a> </p>
<p><strong>Browser Config</strong><br />
If you chose to use an Amazon Elastic IP Address to access your proxy server, the script should output the address in the terminal once the proxy server is setup. In your browser you simply need to enter the proxy setup section and choose &#8220;HTTP Proxy&#8221; using the Amazon Elastic IP Address and port 80.</p>
<p>If you chose to use an SSH HTTP Tunnel to connect to access your proxy server, in your browser enter the proxy setup section and choose &#8220;SOCKS 5&#8243; with the address as localhost on port 9999.</p>
<p><strong>Disclaimer</strong><br />
Whilst using an Amazon EC2 Instance as a personal proxy server should not be a problem, <em>it appears that Amazon do not approve of use of EC2 instances as public proxy servers available to the masses</em>. For this reason please make sure you limit access to the proxy to your computer only as configured in the script. Use this script at your own risk. I cannot be held responsible for any undesired consequences that result from its use.</p>
<p>Anyway, have a try and see how you get on. Don&#8217;t hesitate to get in touch if you have any questions. I&#8217;ve spent quite a bit of time on this and I hope that it can help some other people out. I would appreciate any feedback or suggestions <img src='http://sprayfly.com/tech/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<div id="mainphotoarea"></div>]]></content:encoded>
			<wfw:commentRss>http://sprayfly.com/2009/06/28/shell-script-for-automated-amazon-ec2-personal-proxy-server/feed/</wfw:commentRss>
		<slash:comments>26</slash:comments>
		</item>
		<item>
		<title>Using QQ in Pidgin on Ubuntu &#8211; Login Problems</title>
		<link>http://sprayfly.com/2009/06/27/using-qq-in-pidgin-on-ubuntu-login-problems/</link>
		<comments>http://sprayfly.com/2009/06/27/using-qq-in-pidgin-on-ubuntu-login-problems/#comments</comments>
		<pubDate>Sat, 27 Jun 2009 16:35:55 +0000</pubDate>
		<dc:creator>Jono</dc:creator>
				<category><![CDATA[Bugs]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[登陆]]></category>
		<category><![CDATA[聊天]]></category>
		<category><![CDATA[IM]]></category>
		<category><![CDATA[login]]></category>
		<category><![CDATA[pidgin]]></category>
		<category><![CDATA[QQ]]></category>

		<guid isPermaLink="false">http://sprayfly.com/?p=263</guid>
		<description><![CDATA[As much as I hate it, QQ is a bit of a must have in China as most Chinese people don&#8217;t use Facebook or MSN to communicate online. However, rather than installing and running yet another IM application on my computer, I realised that Pidgin provides fairly good support for the QQ protocol &#8211; which [...]]]></description>
			<content:encoded><![CDATA[<p>As much as I hate it, QQ is a bit of a must have in China as most Chinese people don&#8217;t use Facebook or MSN to communicate online. However, rather than installing and running yet another IM application on my computer, I realised that Pidgin provides fairly good support for the QQ protocol &#8211; which means that I can access all my IM services from one application (Facebook, XiaoNei, Pidgin, Gmail, Hotmail, QQ) hence speeding up my computer a bit. In fact, the current Linux version of QQ lacks a lot of features, is fairly buggy and doesn&#8217;t integrate well with GNOME &#8211; so it&#8217;s probably better to go down the Pidgin route anyway.</p>
<p>After using QQ under Pidgin for a while, I found that sometimes there would be problems on login and that Pidgin would sometimes automatically disable QQ after a number of failed login attempts. It turns out that this can be easily fixed by selecting &#8220;Manage Accounts&#8221; and then &#8220;Modify&#8221; for the QQ account. <a href="http://www.flickr.com/photos/jonolumb/3664979017/" class="tt-flickr tt-flickr-Medium" title="1.png"><img class="alignnone" src="http://farm4.static.flickr.com/3571/3664979017_f2a409cac8.jpg" alt="1.png" width="500" height="335" /></a></p>
<p>In the advanced settings tab, make sure that QQ2008 is selected (the default may well be QQ2005).  It seems that this later version is more stable and login should no longer be a problem. </p>
<p><a href="http://www.flickr.com/photos/jonolumb/3664978127/" class="tt-flickr tt-flickr-Medium" title="2.png"><img class="alignnone" src="http://farm3.static.flickr.com/2597/3664978127_8c90bf8274.jpg" alt="2.png" width="487" height="500" /></a> </p>
<div id="mainphotoarea"></div>]]></content:encoded>
			<wfw:commentRss>http://sprayfly.com/2009/06/27/using-qq-in-pidgin-on-ubuntu-login-problems/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
	</channel>
</rss>
