<?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>Fwolf's Blog &#187; Linux - Fwolf's Blog</title>
	<atom:link href="http://www.fwolf.com/blog/category/linux/feed" rel="self" type="application/rss+xml" />
	<link>http://www.fwolf.com/blog</link>
	<description>随心·随意·随缘·努力～</description>
	<lastBuildDate>Sun, 29 Aug 2010 14:52:23 +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>Ubuntu 升级到 10.04 lucid</title>
		<link>http://www.fwolf.com/blog/post/5</link>
		<comments>http://www.fwolf.com/blog/post/5#comments</comments>
		<pubDate>Wed, 07 Jul 2010 07:06:46 +0000</pubDate>
		<dc:creator>Fwolf</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[lucid]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[ooo]]></category>
		<category><![CDATA[samba]]></category>
		<category><![CDATA[sshfs]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[upgrade]]></category>

		<guid isPermaLink="false">http://www.fwolf.com/blog/post/5</guid>
		<description><![CDATA[本来能够直接从 9.04 升级上来的，但由于我启用了 sshfs，而 mount 在网络启动之前执行，所以系统升级完启动后就挂在 mount sshfs 那里不动了，一开始不知道，以为不行了，就直接重新安装了 10.04，也好，4、5年了，该重装一会了。 启用 Ctrl+Alt+Backspace 快捷键重启 X System-&#62;Preferences-&#62;Keyboard-&#62;Layouts-&#62;Options，打开 Key sequence to kill the X server 并选中 Control+Alt+Backspace，立即生效，或者执行命令： $ setxkbmap -option terminate:ctrl_alt_bksp 这个是每次启动 X 之后执行才生效。 设置系统默认输入法 System-&#62;Administration-&#62;Language Support 中，Install/Remove Languages 中装上中文语言支持，安装 fcitx，然后在 Keyboard input method system 里选上 fcitx，重启 X。 Mysql 服务启动的问题 无法启动或者重启，修改 /etc/init/mysqld.conf，在 start on (net-device-up 后面添加内容如下： start on [...]]]></description>
			<content:encoded><![CDATA[<p>本来能够直接从 9.04 升级上来的，但由于我启用了 sshfs，而 mount 在网络启动之前执行，所以系统升级完启动后就挂在 mount sshfs 那里不动了，一开始不知道，以为不行了，就直接重新安装了 10.04，也好，4、5年了，该重装一会了。</p>

<h4>启用 <code>Ctrl+Alt+Backspace</code> 快捷键重启 X</h4>

<p><code>System-&gt;Preferences-&gt;Keyboard-&gt;Layouts-&gt;Options</code>，打开 <code>Key sequence to kill the X server</code> 并选中 <code>Control+Alt+Backspace</code>，立即生效，或者执行命令：</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ setxkbmap <span style="color: #660033;">-option</span> terminate:ctrl_alt_bksp</pre></div></div>


<p>这个是每次启动 X 之后执行才生效。</p>

<h4>设置系统默认输入法</h4>

<p><code>System-&gt;Administration-&gt;Language Support</code> 中，<code>Install/Remove Languages</code> 中装上中文语言支持，安装 fcitx，然后在 <code>Keyboard input method system</code> 里选上 fcitx，重启 X。</p>

<h4>Mysql 服务启动的问题</h4>

<p>无法启动或者重启，修改 <code>/etc/init/mysqld.conf</code>，在 <code>start on (net-device-up</code> 后面添加内容如下：</p>


<div class="wp_syntax"><div class="code"><pre class="conf" style="font-family:monospace;">start on (net-device-up IFACE=eth0</pre></div></div>


<p>如果提示 <code>Can't create test file</code> 类似的信息导致无法启用，是由于用户变更了 datadir，而系统没有赋予 mysql 读写那个目录的权限所致。修改 <code>/etc/apparmor.d/usr.sbin.mysqld</code> 添加下面的内容：</p>


<div class="wp_syntax"><div class="code"><pre class="config" style="font-family:monospace;">/your new datadir/ r,
/your new datadir/** rwk,</pre></div></div>


<p>并 <code>/etc/init.d/apparmor restart</code> 后 mysql 就能启动了。注意上面的 datadir 如果是 ln 指向，需要填写真实路径。</p>

<p>mysql 还有个烦人的问题，就是 bind-address 默认只是本机，如果想改成 ip 或者 0.0.0.0 代表所有地址，还不能着急，先 bind 127.0.0.1 启动一会，然后停止服务修改 bind-address，不然 <code>sudo service mysql</code> 脚本又会出现问题。</p>

<p>好像 mysql 的自动启动取消了？在 <code>/etc/rc.local</code> 中加一句 <code>service mysql start</code>。</p>

<h4>启动时检查完磁盘就没有反应的问题</h4>

<p>多半是由于 fstab 中有挂载 cifs/smbfs/sshfs 的行为，其实这个时候磁盘还没有检查完，而且永远也检查不完，因为网络还没有启用，那些需要网络挂载驱动器的行为就陷入了永远的等待状态，昏死的设定。</p>

<h4>显卡驱动安装参考</h4>

<ul>
<li><a href="https://help.ubuntu.com/community/RadeonDriver">Ubuntu Documentation > Community Documentation > RadeonDriver </a></li>
<li><a href="http://free3d.org/">3D Graphics hardware performance using Free Software drivers (X.Org DRI)</a></li>
</ul>

<h4>Openoffice.org 字体列表中不显示中文字体名称</h4>

<p>只显示为英文，这个需要修改 <code>/etc/environment</code>：</p>


<div class="wp_syntax"><div class="code"><pre class="conf" style="font-family:monospace;">LANG=&quot;en_US.UTF-8&quot;
LANGUAGE=&quot;en_US:en_GB:en&quot;
LC_CTYPE=&quot;zh_CN.UTF-8&quot;</pre></div></div>


<p>如果输入法又变成 ibus，<code>sudo im-switch -s fcitx</code> 后重启 X 即可。openoffice 是根据当前环境来决定是显示字体的中文名称还是英文名称的。</p>

<h4>Samba 共享中的 symbolic link 无法被访问</h4>

<p>需要在 <code>/etc/samba/smb.conf</code> 中添加下面几句内容：</p>


<div class="wp_syntax"><div class="code"><pre class="conf" style="font-family:monospace;">[global]
    follow symlinks = yes
    wide links = yes
    unix extensions = no</pre></div></div>


<h3>一点使用感觉</h3>

<ul>
<li>很多操作都是在窗口模式下实现，反而用 cli 不知该怎么作了。</li>
<li>易用性倒是好多了，却同时搞得一些复杂操作麻烦或者出问题了，比如 mysql 服务启动的问题，比如 fatab 里面加上个 sshfs 就无法启动的问题等等。</li>
</ul>

<h4>参考</h4>

<ul>
<li><a href="https://wiki.ubuntu.com/X/Config/DontZap">X/Config/DontZap</a></li>
<li><a href="http://www.ihacklog.com/linux/ubuntu/install-and-setup-ubuntu-10-04-lts-lucid-lynx.html">折腾Ubuntu 10.04 LTS (Lucid Lynx)</a></li>
<li><a href="http://www.osdtp.org/2010/02/26/ooo-faq-about-languages-and-fontnames/">OOo 系列语言相关问题</a></li>
<li><a href="http://ubuntuforums.org/showthread.php?t=1480858">Symbolic links in Samba Share in 10.04</a></li>
</ul>

	Tags: <a href="http://www.fwolf.com/blog/post/tag/lucid" title="lucid" rel="tag">lucid</a>, <a href="http://www.fwolf.com/blog/post/tag/mysql" title="mysql" rel="tag">mysql</a>, <a href="http://www.fwolf.com/blog/post/tag/ooo" title="ooo" rel="tag">ooo</a>, <a href="http://www.fwolf.com/blog/post/tag/samba" title="samba" rel="tag">samba</a>, <a href="http://www.fwolf.com/blog/post/tag/sshfs" title="sshfs" rel="tag">sshfs</a>, <a href="http://www.fwolf.com/blog/post/tag/ubuntu" title="Ubuntu" rel="tag">Ubuntu</a>, <a href="http://www.fwolf.com/blog/post/tag/upgrade" title="upgrade" rel="tag">upgrade</a><br />

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.fwolf.com/blog/post/428" title="升级到Ubuntu Intrepid后感觉到的一些变化 (2009-01-06)">升级到Ubuntu Intrepid后感觉到的一些变化</a> (0)</li>
	<li><a href="http://www.fwolf.com/blog/post/426" title="升级到8.10 intrepid过程中libc6依赖性死循环问题的解决 (2009-01-04)">升级到8.10 intrepid过程中libc6依赖性死循环问题的解决</a> (6)</li>
	<li><a href="http://www.fwolf.com/blog/post/152" title="[Ubuntu]使用点滴 (2006-07-08)">[Ubuntu]使用点滴</a> (7)</li>
	<li><a href="http://www.fwolf.com/blog/post/442" title="Ubuntu升级到9.04 Jaunty的变化和遇到的问题 (2009-05-15)">Ubuntu升级到9.04 Jaunty的变化和遇到的问题</a> (2)</li>
	<li><a href="http://www.fwolf.com/blog/post/403" title="Ubuntu从Gutsy升级到Hardy，php5-sybase又掉链子 (2008-06-12)">Ubuntu从Gutsy升级到Hardy，php5-sybase又掉链子</a> (2)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://www.fwolf.com/blog/post/5/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>配置安全的共享web服务器（抛砖引玉）</title>
		<link>http://www.fwolf.com/blog/post/443</link>
		<comments>http://www.fwolf.com/blog/post/443#comments</comments>
		<pubDate>Tue, 09 Jun 2009 10:26:35 +0000</pubDate>
		<dc:creator>Fwolf</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[safe]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[sftp]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://www.fwolf.com/blog/?p=443</guid>
		<description><![CDATA[本文所讲的共享web服务器，并非共享文件的服务器，而是多人一起使用的web服务器，各有各自的网站、管理自己的文件，互不干涉，且对系统无影响。鉴于功力较浅，只敢对较信得过的朋友开放这种账号，本文涉及的范围也有限，所以安全漏洞可能还有，请诸位切勿直接用于生产环境。 服务器环境：Ubuntu 8.10, OpenSSH_5.1p1 Debian-3ubuntu1, Apache 2.2.9, PHP 5.2.6-2ubuntu4 登录 &#8211; SFTP 传统的 FTP 肯定是不如这个安全，telnet 更不用说了。使用 SFTP 还有一个起始想法是想配置证书自动登录，后来发现 SFTP 客户端（FileZilla）没这功能，就没再作下去，命令行下 scp 的自动登录倒是 和 ssh 的一样很好配置。 网上很多文章介绍把 sftp 用户限制在 $HOME 目录下的方法，使用的是 sshd 的 ChrootGroups 选项，这个选项在我的版本里没有找到，找到另外一篇参考文章使用的是 ChrootDirectory，也很好用。 创建一个用户组，作为所有 sftp 用户的用户组： $ sudo groupadd sftp 创建用户，设置密码，并归入 sftp 组： $ sudo useradd -m friend $ sudo passwd friend $ [...]]]></description>
			<content:encoded><![CDATA[<p>本文所讲的共享web服务器，并非共享文件的服务器，而是多人一起使用的web服务器，各有各自的网站、管理自己的文件，互不干涉，且对系统无影响。鉴于功力较浅，只敢对较信得过的朋友开放这种账号，本文涉及的范围也有限，所以安全漏洞可能还有，请诸位切勿直接用于生产环境。</p>

<p>服务器环境：Ubuntu 8.10, OpenSSH_5.1p1 Debian-3ubuntu1, Apache 2.2.9, PHP 5.2.6-2ubuntu4</p>

<h3>登录 &#8211; SFTP</h3>

<p>传统的 FTP 肯定是不如这个安全，telnet 更不用说了。使用 SFTP 还有一个起始想法是想配置证书自动登录，后来发现 SFTP 客户端（FileZilla）没这功能，就没再作下去，命令行下 scp 的自动登录倒是 和<a href="279"> ssh 的</a>一样很好配置。</p>

<p>网上很多文章介绍把 sftp 用户限制在 <code>$HOME</code> 目录下的方法，使用的是 sshd 的 ChrootGroups 选项，这个选项在我的版本里没有找到，找到<a href="http://shapeshed.com/journal/chroot_sftp_users_on_ubuntu_intrepid/">另外一篇参考文章</a>使用的是 ChrootDirectory，也很好用。</p>

<p>创建一个用户组，作为所有 sftp 用户的用户组：</p>

<pre><code>$ sudo groupadd sftp
</code></pre>

<p>创建用户，设置密码，并归入 sftp 组：</p>

<pre><code>$ sudo useradd -m friend
$ sudo passwd friend
$ sudo usermod -g sftp friend
</code></pre>

<p>为了进一步增强安全性，还可以将用户的登录 shell 设置为 <code>/bin/false</code>，是个好习惯，但在本例中并非必须，下面的 sshd 设置也会让用户无法登录 shell （我观察的结果）。</p>

<pre><code>$ sudo usermod -s /bin/false friend
</code></pre>

<p>下来就要配置 sshd 了，编辑配置文件 <code>/etc/ssh/sshd_config</code>：</p>

<pre><code># 修改下面这句
#Subsystem sftp /usr/lib/openssh/sftp-server
Subsystem sftp internal-sftp
</code></pre>

<p>然后在此配置文件末尾添加：</p>

<pre><code>Match group sftp
    X11Forwarding no
    ChrootDirectory %h
    AllowTcpForwarding no
    ForceCommand internal-sftp
</code></pre>

<p>配置含义大概为：凡是 sftp 组的用户，关闭 X 转发，chroot 到 <code>$HOME</code> 目录，关闭 TCP 转发（无法使用隧道了？），强制使用 internal-sftp（这个不明白）。</p>

<p>现在，重启 ssh 服务，用户就只能通过 sftp 访问 <code>/home/friend</code> 下的文件了。</p>

<p>PS: 我发现 sshd 如果配置错误，在 restart 服务的时候会先检查，而不是直接 stop 服务然后在 start 的时候出现错误，搞得服务启不来。大概是考虑到很多人都是远程 ssh 上来进行维护，服务 down 了以后就麻烦了，很贴心的设置。</p>

<h3>Apache &amp; PHP</h3>

<p>Apache 配置简单，创建 <code>/home/friend/www</code> 目录，约定网站文件都放在这个目录下，然后弄个 Alias 指向就可以了。</p>

<p>但有一个极大的安全隐患需要堵上，用户可以通过编写 PHP 程序，读取系统中任何 www-data 用户有权限访问的文件，包括系统的 shadow 文件，包括 其它用户的网站文件等等。解决这个问题，一种是开启 PHP 的 safe_mode ，安全模式下 PHP 将只能访问 owner 为自己（也就是 www-data）的文件；另外一种是使用 <a href="http://cn2.php.net/manual/en/ini.sect.safe-mode.php">open_basedir</a>，这将限制 PHP 只能打开某一目录树下的文件，并且不可能通过符号链接避开此限制。显然 safe_mode 的副作用太多，后一种方法更适合我的这种情况，配置写到 Apache 的 conf 里就行了：</p>

<pre><code>&lt;Directory /home/friend&gt;
    php_admin_value open_basedir "/home/friend/"
&lt;/Directory&gt;
</code></pre>

<p>注意open_basedir 后面的参数只代表文件路径的前缀，所以要带上末尾的斜杠，明确指出是目录。</p>

<p>不使用 safe_mode 的另外一个原因是在未来的 PHP6 里就要删掉它了。</p>

<h3>缺点</h3>

<p>最大的缺点就是 sftp 用户无法自己更改密码，除非自己写个守护程序啥的。这个程序在写的时候要非常小心，因为操作的是系统用户文件，如果遗留有安全漏洞可能会使别人获得其它用户权限。一个折中的方法是写个程序，定期更改密码并通过邮件告知用户，虽不方便但安全性要好一些。</p>

	Tags: <a href="http://www.fwolf.com/blog/post/tag/apache" title="Apache" rel="tag">Apache</a>, <a href="http://www.fwolf.com/blog/post/tag/php" title="PHP" rel="tag">PHP</a>, <a href="http://www.fwolf.com/blog/post/tag/safe" title="safe" rel="tag">safe</a>, <a href="http://www.fwolf.com/blog/post/tag/security" title="security" rel="tag">security</a>, <a href="http://www.fwolf.com/blog/post/tag/sftp" title="sftp" rel="tag">sftp</a>, <a href="http://www.fwolf.com/blog/post/tag/ssh" title="ssh" rel="tag">ssh</a><br />

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.fwolf.com/blog/post/411" title="由一个错误学到的一些php安全配置问题 (2008-07-13)">由一个错误学到的一些php安全配置问题</a> (4)</li>
	<li><a href="http://www.fwolf.com/blog/post/300" title="针对$_SERVER['PHP_SELF']的跨站脚本攻击（XSS） (2007-03-18)">针对$_SERVER['PHP_SELF']的跨站脚本攻击（XSS）</a> (3)</li>
	<li><a href="http://www.fwolf.com/blog/post/347" title="升级MT dv 3.0主机到php5 (2007-08-09)">升级MT dv 3.0主机到php5</a> (9)</li>
	<li><a href="http://www.fwolf.com/blog/post/127" title="利用SVN更新网站 (2006-01-19)">利用SVN更新网站</a> (7)</li>
	<li><a href="http://www.fwolf.com/blog/post/395" title="防止垃圾评论的另类方法 (2008-04-10)">防止垃圾评论的另类方法</a> (6)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://www.fwolf.com/blog/post/443/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Ubuntu升级到9.04 Jaunty的变化和遇到的问题</title>
		<link>http://www.fwolf.com/blog/post/442</link>
		<comments>http://www.fwolf.com/blog/post/442#comments</comments>
		<pubDate>Fri, 15 May 2009 15:20:55 +0000</pubDate>
		<dc:creator>Fwolf</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[fluxbox]]></category>
		<category><![CDATA[font]]></category>
		<category><![CDATA[jaunty]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[upgrade]]></category>
		<category><![CDATA[xorg]]></category>

		<guid isPermaLink="false">http://www.fwolf.com/blog/post/442</guid>
		<description><![CDATA[长按键盘自动连续击键的间隔缩短了。 显卡驱动没有问题，终于能够摆脱8.10里像涂了墨水一样的中文字乱码了。 Firefox的速度好像也快了不少，或许也是显卡驱动的原因？ Fluxbox apps文件中Position设置LOWERLEFT/BOTTOMLEFT原来时从屏幕最下方算间距，现在时从工具栏上方开始算，所以原来的值要减去工具栏的高度（25）。 消失很久的启动时的Splash屏又回来了，不过是Xubuntu的小老鼠（我用的WM是Fluxbox），想取消的话，删掉usplash及其相关的包即可。 如果在没有正式发布的时候就升级了，每天的更新比正式发布后要多得多，每天都要下载一大堆包升级，得考虑好，当然你也可以忍着不频繁升级。 Fluxbox任务栏上当前聚焦的窗口和其他窗口的风格是一样的，区分不开了，更换任何styles都无效。 Firefox窗口的标题栏里中文字显示为方块 先这个是Gnome的问题，所有窗口标题栏中包含中文时都是方块，而Fluxbox工具栏上是能够正确显示中文的。尝试更换不同的fluxbox styles发现menu.title.font设置为dejavu字体时窗口标题栏就能正常显示中文了，其他的窗口内容、网页中文全部显示正常。 终于让我找到原因了，又是一个哭笑不得的问题，在我自定义风格里，使用了dejavusans这个字体，而这个字体现在好像在系统中找不到了，因此它就像出错后就不再往下执行了一样，导致后面overlay里定义的新字体也不生效，窗口栏上的中文就成方块了。换其他style之所以能正常显示窗口标题栏上的中文，是因为他们没用dejavusans这个字体。最后的解决方案，把这个自定义style里的dejavusans替换成dejavu -_-! 字体大小dpi优化 字体DPI设置会根据显示器进行优化，而不再局限于默认的96DPI，还可以在System → Preferences → Appearance → Fonts → Details里自行定义。原来是在.Xresources里设置的Xft.dpi:96，不知道还有用没。目前发现的问题是窗口标题栏中的文字比以前大了一些。 我的Fluxbox还遇到了一个问题，屏幕尺寸、位置计算出现了错误，原先我是/etc/gdm/Init/Default中用xrandr -s 1024x768强制重设分辨率，现在把这行禁用后发现桌面的“尺寸”比1024大，鼠标移动到屏幕边缘后会自动移动，但显示不全。 $ xdpyinfo &#124;grep resolution resolution: 78x78 dots per inch 78是显示器真正的dpi数，但按这个设置又显得字太小了。最后，把xorg.conf里大于1024的分辨率都删掉，这样就可以去掉上面xrandr那句了，显示也正常了，dpi仍然用的是96。 上某些网站中文字模糊（像粗体字那样的模糊） 打开/etc/fonts/conf.d/44-wqy-zenhei.conf，找到下面这行： &#60;edit name=&#34;antialias&#34; mode=&#34;assign&#34;&#62;&#60;bool&#62;true&#60;/bool&#62;&#60;/edit&#62; 把true改成false后重启X即可。 Ctrl+Alt+Backspace关闭X的组合键被禁用了 编辑/etc/X11/xorg.conf，在最后加上： Section &#34;ServerFlags&#34; Option &#34;DontZap&#34; &#34;no&#34; EndSection Tags: fluxbox, font, jaunty, Ubuntu, [...]]]></description>
			<content:encoded><![CDATA[<ul>
<li>长按键盘自动连续击键的间隔缩短了。</li>
<li>显卡驱动没有问题，终于能够摆脱8.10里像涂了墨水一样的中文字乱码了。</li>
<li>Firefox的速度好像也快了不少，或许也是显卡驱动的原因？</li>
<li>Fluxbox apps文件中Position设置LOWERLEFT/BOTTOMLEFT原来时从屏幕最下方算间距，现在时从工具栏上方开始算，所以原来的值要减去工具栏的高度（25）。</li>
<li>消失很久的启动时的Splash屏又回来了，不过是Xubuntu的小老鼠（我用的WM是Fluxbox），想取消的话，删掉<code>usplash</code>及其相关的包即可。</li>
</ul>

<p>如果在没有正式发布的时候就升级了，每天的更新比正式发布后要多得多，每天都要下载一大堆包升级，得考虑好，当然你也可以忍着不频繁升级。</p>

<h4>Fluxbox任务栏上当前聚焦的窗口和其他窗口的风格是一样的，区分不开了，更换任何styles都无效。</h4>

<h4>Firefox窗口的标题栏里中文字显示为方块</h4>

<p>先这个是Gnome的问题，所有窗口标题栏中包含中文时都是方块，而Fluxbox工具栏上是能够正确显示中文的。尝试更换不同的fluxbox styles发现<code>menu.title.font</code>设置为dejavu字体时窗口标题栏就能正常显示中文了，其他的窗口内容、网页中文全部显示正常。</p>

<p>终于让我找到原因了，又是一个哭笑不得的问题，在我自定义风格里，使用了dejavusans这个字体，而这个字体现在好像在系统中找不到了，因此它就像出错后就不再往下执行了一样，导致后面overlay里定义的新字体也不生效，窗口栏上的中文就成方块了。换其他style之所以能正常显示窗口标题栏上的中文，是因为他们没用dejavusans这个字体。最后的解决方案，把这个自定义style里的dejavusans替换成dejavu -_-!</p>

<h4>字体大小dpi优化</h4>

<p>字体DPI设置会根据显示器进行优化，而不再局限于默认的96DPI，还可以在System → Preferences → Appearance → Fonts → Details里自行定义。原来是在<code>.Xresources</code>里设置的<code>Xft.dpi:96</code>，不知道还有用没。目前发现的问题是窗口标题栏中的文字比以前大了一些。</p>

<p>我的Fluxbox还遇到了一个问题，屏幕尺寸、位置计算出现了错误，原先我是<code>/etc/gdm/Init/Default</code>中用<code>xrandr -s 1024x768</code>强制重设分辨率，现在把这行禁用后发现桌面的“尺寸”比1024大，鼠标移动到屏幕边缘后会自动移动，但显示不全。</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">	$ xdpyinfo <span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">grep</span> resolution
	  resolution:    78x78 dots per inch</pre></div></div>


<p>78是显示器真正的dpi数，但按这个设置又显得字太小了。最后，把<code>xorg.conf</code>里大于1024的分辨率都删掉，这样就可以去掉上面<code>xrandr</code>那句了，显示也正常了，dpi仍然用的是96。</p>

<h4>上某些网站中文字模糊（像粗体字那样的模糊）</h4>

<p>打开<code>/etc/fonts/conf.d/44-wqy-zenhei.conf</code>，找到下面这行：</p>


<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;edit</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;antialias&quot;</span> <span style="color: #000066;">mode</span>=<span style="color: #ff0000;">&quot;assign&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;bool<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>true<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/bool<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;/edit<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>


<p>把true改成false后重启X即可。</p>

<h4>Ctrl+Alt+Backspace关闭X的组合键被禁用了</h4>

<p>编辑<code>/etc/X11/xorg.conf</code>，在最后加上：</p>


<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;">	Section <span style="color: #933;">&quot;ServerFlags&quot;</span>
		Option <span style="color: #933;">&quot;DontZap&quot;</span> <span style="color: #933;">&quot;no&quot;</span>
	EndSection</pre></div></div>


	Tags: <a href="http://www.fwolf.com/blog/post/tag/fluxbox" title="fluxbox" rel="tag">fluxbox</a>, <a href="http://www.fwolf.com/blog/post/tag/font" title="font" rel="tag">font</a>, <a href="http://www.fwolf.com/blog/post/tag/jaunty" title="jaunty" rel="tag">jaunty</a>, <a href="http://www.fwolf.com/blog/post/tag/ubuntu" title="Ubuntu" rel="tag">Ubuntu</a>, <a href="http://www.fwolf.com/blog/post/tag/upgrade" title="upgrade" rel="tag">upgrade</a>, <a href="http://www.fwolf.com/blog/post/tag/xorg" title="xorg" rel="tag">xorg</a><br />

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.fwolf.com/blog/post/170" title="[Ubuntu]明明白白安装中文字体 (2006-05-17)">[Ubuntu]明明白白安装中文字体</a> (20)</li>
	<li><a href="http://www.fwolf.com/blog/post/403" title="Ubuntu从Gutsy升级到Hardy，php5-sybase又掉链子 (2008-06-12)">Ubuntu从Gutsy升级到Hardy，php5-sybase又掉链子</a> (2)</li>
	<li><a href="http://www.fwolf.com/blog/post/414" title="接多显示器的一点提示 (2008-07-17)">接多显示器的一点提示</a> (0)</li>
	<li><a href="http://www.fwolf.com/blog/post/428" title="升级到Ubuntu Intrepid后感觉到的一些变化 (2009-01-06)">升级到Ubuntu Intrepid后感觉到的一些变化</a> (0)</li>
	<li><a href="http://www.fwolf.com/blog/post/426" title="升级到8.10 intrepid过程中libc6依赖性死循环问题的解决 (2009-01-04)">升级到8.10 intrepid过程中libc6依赖性死循环问题的解决</a> (6)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://www.fwolf.com/blog/post/442/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>控制ThinkPad的风扇</title>
		<link>http://www.fwolf.com/blog/post/438</link>
		<comments>http://www.fwolf.com/blog/post/438#comments</comments>
		<pubDate>Sun, 12 Apr 2009 10:22:49 +0000</pubDate>
		<dc:creator>Fwolf</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[acpi]]></category>
		<category><![CDATA[fan]]></category>
		<category><![CDATA[hardware]]></category>
		<category><![CDATA[IBM]]></category>
		<category><![CDATA[temperature]]></category>
		<category><![CDATA[thinkpad]]></category>

		<guid isPermaLink="false">http://www.fwolf.com/blog/post/438</guid>
		<description><![CDATA[我的旧本子X31风扇很久都不转了，今天查了点资料，搞了搞，感觉状态上好，记录如下： 首先要能了解当前温度和风扇转速，安装lm-sensors包就能用了： $ sensors acpitz-virtual-0 Adapter: Virtual device temp1: +42.0°C (crit = +91.0°C) thinkpad-isa-0000 Adapter: ISA adapter fan1: 3614 RPM temp1: +42.0°C temp2: +48.0°C temp3: +48.0°C temp4: +42.0°C temp5: +32.0°C ERROR: Can't get value of subfeature temp6_input: Can't read temp6: +0.0°C temp7: +29.0°C ERROR: Can't get value of subfeature temp8_input: Can't read temp8: +0.0°C 按说lm-sensors也能控制风扇的，但对我的本子不适用。 [...]]]></description>
			<content:encoded><![CDATA[<p>我的旧本子X31风扇很久都不转了，今天查了点资料，搞了搞，感觉状态上好，记录如下：</p>

<p>首先要能了解当前温度和风扇转速，安装<code>lm-sensors</code>包就能用了：</p>

<pre><code>$ sensors
acpitz-virtual-0
Adapter: Virtual device
temp1:       +42.0°C  (crit = +91.0°C)                  

thinkpad-isa-0000
Adapter: ISA adapter
fan1:       3614 RPM
temp1:       +42.0°C                                    
temp2:       +48.0°C                                    
temp3:       +48.0°C                                    
temp4:       +42.0°C                                    
temp5:       +32.0°C                                    
ERROR: Can't get value of subfeature temp6_input: Can't read
temp6:        +0.0°C                                    
temp7:       +29.0°C                                    
ERROR: Can't get value of subfeature temp8_input: Can't read
temp8:        +0.0°C      
</code></pre>

<p>按说<a href="http://blog.cathayan.org/item/1867">lm-sensors也能控制风扇</a>的，但对我的本子不适用。</p>

<p>然后就是在内核中挂载ThinkPad的高级电源控制模块，在<code>/etc/modprobe.d/options</code>里添加这么一句，后面的参数fan_control很重要：</p>

<pre><code>options thinkpad_acpi fan_control=1
</code></pre>

<p>重启，或者手工重新挂载模块：</p>

<pre><code>rmmod thinkpad_acpi
modprobe thinkpad_acpi
</code></pre>

<p>好了，控制风扇转速，最基本的方法是（如无意外，本文中的大部分命令都要用root用户操作）：</p>

<pre><code>echo level [level] &gt; /proc/acpi/ibm/fan
</code></pre>

<p>[level]的取值可以是0-7之间的数字，或者auto，或者disengaged/full-speed，在不同的本子上会有不同的效果，总体来说数字越大转速越高，auto是系统自动判断，但在我的本子上却是不转，disengaged/full-speed是全速。我自己用的本子，设为4左右就能达到温度和噪音的平衡点。</p>

<p>还有人在这个基础上写了一些小工具，比如<a href="http://www.thinkwiki.org/wiki/Talk:Code/tp-fancontrol">tp-fancontrol</a>或者<a href="http://www.gambitchess.org/mediawiki/index.php/ThinkPad_Fan_Control">ThinkPad Fan Control</a>，主要功能都是定时探测温度，然后安装预先的设定来控制风扇的转速。但由于不同硬件的差异，他们并不适用于所有情况，比如我的X31装上哪一个风扇都是auto不转，只好手工echo然后让风扇常转了。智能一点的，还可以借助cron来个定时开关、定时检测什么的。</p>

<h4>参考</h4>

<ul>
<li><a href="http://www.thinkwiki.org/wiki/How_to_control_fan_speed">How to control fan speed</a></li>
</ul>

	Tags: <a href="http://www.fwolf.com/blog/post/tag/acpi" title="acpi" rel="tag">acpi</a>, <a href="http://www.fwolf.com/blog/post/tag/fan" title="fan" rel="tag">fan</a>, <a href="http://www.fwolf.com/blog/post/tag/hardware" title="hardware" rel="tag">hardware</a>, <a href="http://www.fwolf.com/blog/post/tag/ibm" title="IBM" rel="tag">IBM</a>, <a href="http://www.fwolf.com/blog/post/tag/temperature" title="temperature" rel="tag">temperature</a>, <a href="http://www.fwolf.com/blog/post/tag/thinkpad" title="thinkpad" rel="tag">thinkpad</a><br />

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.fwolf.com/blog/post/417" title="机房搬家过程中的几件趣事 (2009-03-22)">机房搬家过程中的几件趣事</a> (0)</li>
	<li><a href="http://www.fwolf.com/blog/post/152" title="[Ubuntu]使用点滴 (2006-07-08)">[Ubuntu]使用点滴</a> (7)</li>
	<li><a href="http://www.fwolf.com/blog/post/372" title="Linux下使用华为h3c Aolynk WuB320G无线网卡 (2007-12-02)">Linux下使用华为h3c Aolynk WuB320G无线网卡</a> (0)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://www.fwolf.com/blog/post/438/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>安装ibus输入法</title>
		<link>http://www.fwolf.com/blog/post/437</link>
		<comments>http://www.fwolf.com/blog/post/437#comments</comments>
		<pubDate>Sun, 05 Apr 2009 19:08:37 +0000</pubDate>
		<dc:creator>Fwolf</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[chinese]]></category>
		<category><![CDATA[fcitx]]></category>
		<category><![CDATA[ibus]]></category>
		<category><![CDATA[input]]></category>

		<guid isPermaLink="false">http://www.fwolf.com/blog/post/437</guid>
		<description><![CDATA[编译太麻烦，直接从ppa的源安装，把下面这句加入/etc/apt/sources.list： deb http://ppa.launchpad.net/ibus-dev/ppa/ubuntu intrepid main 然后安装就是了，不过ppa的源下载真的好慢啊： $ sudo aptitude install ibus ibus-pinyin 装好以后，修改/etc/X11/Xsession.d/95xinput，把原来fcitx的部分注释掉，换成ibus的： # ibus export GTK_IM_MODULE=&#34;ibus&#34; export XMODIFIERS=&#34;@im=ibus&#34; export QT_IM_MODULE=&#34;ibus&#34; 然后切换系统的默认输入法： $ sudo im-switch -c 最后重启系统，一切ok。 一点感受： 速度比fcitx要慢，但似乎用着反而更舒服了。 没有软键盘，无法输入特殊符号（前提：我用自然码双拼，得切换到全拼下用i开头输入特殊符号，如果有全拼/双拼切换快捷键就好了）。 haha xixi rq xq lb sj bsn 这些很贴心啊，呵呵。 选用目前并不一定比fcitx好用的ibus，主要是看中它更新比较频繁，相信问题会不断得到修复，功能也会不断完善的。使用python开发也能够让更多的热心人介入。 Update @ 2009-04-21 如果在firefox等程序里无法实现光标跟随，可以试试装上ibus-gtk, ibus-qt4包，然后重启X。 Tags: chinese, fcitx, ibus, input, Linux Related posts 发现fcitx也很不错嘛 (6) 配置ssh的自动登录 [...]]]></description>
			<content:encoded><![CDATA[<p>编译太麻烦，直接从<a href="https://launchpad.net/~ibus-dev/+archive/ppa">ppa的源</a>安装，把下面这句加入<code>/etc/apt/sources.list</code>：</p>


<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;">	deb http://ppa.launchpad.net/ibus-dev/ppa/ubuntu intrepid main</pre></div></div>


<p>然后安装就是了，不过ppa的源下载真的好慢啊：</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">	$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">aptitude</span> <span style="color: #c20cb9; font-weight: bold;">install</span> ibus ibus-pinyin</pre></div></div>


<p>装好以后，修改<code>/etc/X11/Xsession.d/95xinput</code>，把原来fcitx的部分注释掉，换成ibus的：</p>


<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;">	# ibus
	export GTK_IM_MODULE<span style="color: #000066; font-weight:bold;">=</span><span style="color: #933;">&quot;ibus&quot;</span>
	export XMODIFIERS<span style="color: #000066; font-weight:bold;">=</span><span style="color: #933;">&quot;@im=ibus&quot;</span>
	export QT_IM_MODULE<span style="color: #000066; font-weight:bold;">=</span><span style="color: #933;">&quot;ibus&quot;</span></pre></div></div>


<p>然后切换系统的默认输入法：</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">	$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> im-switch <span style="color: #660033;">-c</span></pre></div></div>


<p>最后重启系统，一切ok。</p>

<p>一点感受：</p>

<ul>
<li>速度比fcitx要慢，但似乎用着反而更舒服了。</li>
<li>没有软键盘，无法输入特殊符号（前提：我用自然码双拼，得切换到全拼下用i开头输入<a href="http://github.com/phuang/ibus-pinyin/blob/master/engine/special_table">特殊符号</a>，如果有全拼/双拼切换快捷键就好了）。</li>
<li>haha xixi rq xq lb sj bsn 这些很贴心啊，呵呵。</li>
</ul>

<p>选用目前并不一定比fcitx好用的ibus，主要是看中它更新比较频繁，相信问题会不断得到修复，功能也会不断完善的。使用python开发也能够让更多的热心人介入。</p>

<h4>Update @ 2009-04-21</h4>

<p>如果在firefox等程序里无法实现光标跟随，可以试试装上ibus-gtk, ibus-qt4包，然后重启X。</p>

	Tags: <a href="http://www.fwolf.com/blog/post/tag/chinese" title="chinese" rel="tag">chinese</a>, <a href="http://www.fwolf.com/blog/post/tag/fcitx" title="fcitx" rel="tag">fcitx</a>, <a href="http://www.fwolf.com/blog/post/tag/ibus" title="ibus" rel="tag">ibus</a>, <a href="http://www.fwolf.com/blog/post/tag/input" title="input" rel="tag">input</a>, <a href="http://www.fwolf.com/blog/post/tag/linux" title="Linux" rel="tag">Linux</a><br />

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.fwolf.com/blog/post/338" title="发现fcitx也很不错嘛 (2007-07-08)">发现fcitx也很不错嘛</a> (6)</li>
	<li><a href="http://www.fwolf.com/blog/post/279" title="配置ssh的自动登录 (2007-01-05)">配置ssh的自动登录</a> (13)</li>
	<li><a href="http://www.fwolf.com/blog/post/400" title="选择Eclipse PHP Development Tools(PDT)作为PHP开发工具 (2008-05-03)">选择Eclipse PHP Development Tools(PDT)作为PHP开发工具</a> (8)</li>
	<li><a href="http://www.fwolf.com/blog/post/176" title="让phpmailer支持中文名称的附件 (2006-05-23)">让phpmailer支持中文名称的附件</a> (5)</li>
	<li><a href="http://www.fwolf.com/blog/post/410" title="用ssh打通反向隧道，内网也可对外提供服务 (2008-07-10)">用ssh打通反向隧道，内网也可对外提供服务</a> (2)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://www.fwolf.com/blog/post/437/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
