<?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>筍子工作雜記 &#187; FreeBSD</title>
	<atom:link href="http://twycf.com/wordpress/archives/category/freebsd/feed" rel="self" type="application/rss+xml" />
	<link>http://twycf.com/wordpress</link>
	<description>工作、休閒之類的雜記</description>
	<lastBuildDate>Wed, 18 Nov 2009 15:20:44 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Proftpd 支援 UTF-8 + MYSQL 虛擬帳號 + Quota 限制</title>
		<link>http://twycf.com/wordpress/archives/166</link>
		<comments>http://twycf.com/wordpress/archives/166#comments</comments>
		<pubDate>Wed, 18 Nov 2009 15:20:05 +0000</pubDate>
		<dc:creator>shinnlu</dc:creator>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Services]]></category>
		<category><![CDATA[ftp]]></category>
		<category><![CDATA[虛擬帳號]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[proftpd]]></category>
		<category><![CDATA[utf8]]></category>

		<guid isPermaLink="false">http://twycf.com/wordpress/?p=166</guid>
		<description><![CDATA[原文參考:[FreeBSD &#038; Linux Ubuntu] Proftpd 支援 UTF-8 + MYSQL 虛擬帳號 + Quota 限制
原始文章中有一些錯誤，我會在內文中更正這些錯誤
安裝之前準備工作
portsnap fetch &#38;&#38; portsnap update
Mysql 要先安裝好

安裝時才不會安裝到不支援 UTF8 的舊版本，本次安裝為 proftpd-1.3.2b
實驗環境：
FreeBSD 7.2-Releaseproftpd 1.3.2b
安裝方式
cd /usr/ports/ftp/proftpd-mysqlmake install clean
選擇
NLSQuotaMysqlRatio
建立資料庫
CREATE DATABASE `ftp` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
建立使用者資料表，這個資料表是紀錄使用者的所有資料
# username 使用者帳號# uid 系統的 uid 這個可以自己隨便給個數字，不要重複到系統帳號# gid 系統的 gid 這個看你用途是什麼來去對應# password 使用者密碼# homedir 使用者家目錄# shell 使用者的 shell 最好是填 /sbin/nologin# accessed 使用者最後登入的時間# [...]]]></description>
		<wfw:commentRss>http://twycf.com/wordpress/archives/166/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SSH Allow with tcp_wrappers</title>
		<link>http://twycf.com/wordpress/archives/49</link>
		<comments>http://twycf.com/wordpress/archives/49#comments</comments>
		<pubDate>Sun, 24 Dec 2006 09:22:03 +0000</pubDate>
		<dc:creator>shinnlu</dc:creator>
				<category><![CDATA[FreeBSD]]></category>

		<guid isPermaLink="false">http://twycf.com/wordpress/archives/49</guid>
		<description><![CDATA[常看系統 log 時會發現， /var/log/auth.log 常常會有無聊的人在 Try SSH 系統帳號/密碼，此時最好的防護方式就是讓無聊的人連 Try 的機會也沒有，這時要搭配 tcp_wrappers。
在 /etc/hosts.allow 前面加入：
sshd : ALL except \192.168.1.0/255.255.255.0 222.111.222.111/255.255.255.255 : \spawn=(echo `date` - %u@%h[%a] %d&#124;/usr/bin/mail -s &#34;tcp_wrappers&#34; root) &#38; : deny
222.111.222.111 指的是特定允許使用 ssh 進主機的IP，當然還可以加入更多允許的管理主機IP，兩組 IP 間要留一個空格做分隔 (如 111.222.333.444 111.222.333.445 111.222.333.446)。192.168.1.0/255.255.255.0 指的是允許內部子網域內電腦 IP 全部開放可以進入主機，後面的網路遮罩 /255.255.255.0 也別忘了照自己的設定修改。
如此的設定除了允許的 IP 可以進入主機外，其他的 IP 只要嘗試進入都會被拒絕，且系統會自動發一封信給 root，也保障系統帳號不會被 Bruteforce。  
]]></description>
		<wfw:commentRss>http://twycf.com/wordpress/archives/49/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>讓 Apache 不要記錄指定 IP</title>
		<link>http://twycf.com/wordpress/archives/131</link>
		<comments>http://twycf.com/wordpress/archives/131#comments</comments>
		<pubDate>Thu, 24 Aug 2006 07:25:46 +0000</pubDate>
		<dc:creator>shinnlu</dc:creator>
				<category><![CDATA[Services]]></category>

		<guid isPermaLink="false">http://twycf.com/wordpress/archives/131</guid>
		<description><![CDATA[這一陣子常常分析 Apache 的 httpd_access.log ，做一些使用者來源、瀏覽器、作業系統、以及網站來源參考的分析，在分析的過程中發現自己在 log 裡留下的記錄非常多，所以將 Apache 的設定檔加入以下參數，讓 Apache 不要記錄指定的 IP 位址：
SetEnvIf Remote_Addr &#34;127\.0\.0\.1&#34; dontlogSetEnvIf Remote_Addr &#34;192\.168\.1\.10&#34; dontlog
並且將
CustomLog logs/access.log combined
改為
CustomLog logs/access.log combined env=!dontlog
參考文件：Log Files
]]></description>
		<wfw:commentRss>http://twycf.com/wordpress/archives/131/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Samba 設定檔變數列表</title>
		<link>http://twycf.com/wordpress/archives/96</link>
		<comments>http://twycf.com/wordpress/archives/96#comments</comments>
		<pubDate>Sat, 29 Jul 2006 12:12:09 +0000</pubDate>
		<dc:creator>shinnlu</dc:creator>
				<category><![CDATA[FreeBSD]]></category>

		<guid isPermaLink="false">http://twycf.com/wordpress/archives/96</guid>
		<description><![CDATA[以下資料由  Samba 線上文件摘錄
%U
session username (the username that the client wanted, not necessarily the same as the one they got).
%G
primary group name of %U.
%h
the Internet hostname that Samba is running on.
%m
the NetBIOS name of the client machine (very useful).
This parameter is not available when Samba listens on port 445, as clients no longer send this [...]]]></description>
		<wfw:commentRss>http://twycf.com/wordpress/archives/96/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Unix History</title>
		<link>http://twycf.com/wordpress/archives/61</link>
		<comments>http://twycf.com/wordpress/archives/61#comments</comments>
		<pubDate>Fri, 02 Jun 2006 17:13:50 +0000</pubDate>
		<dc:creator>shinnlu</dc:creator>
				<category><![CDATA[FreeBSD]]></category>

		<guid isPermaLink="false">http://twycf.com/wordpress/archives/61</guid>
		<description><![CDATA[Unix 系統完整分支圖，雖然很久以前看過，不過想要找的時候卻找不到，先在部落格上備個案
http://www.levenez.com/unix/
http://www.levenez.com/unix/history.html
]]></description>
		<wfw:commentRss>http://twycf.com/wordpress/archives/61/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>無痛式垃圾郵件過濾系統</title>
		<link>http://twycf.com/wordpress/archives/56</link>
		<comments>http://twycf.com/wordpress/archives/56#comments</comments>
		<pubDate>Fri, 02 Jun 2006 17:09:37 +0000</pubDate>
		<dc:creator>shinnlu</dc:creator>
				<category><![CDATA[FreeBSD]]></category>

		<guid isPermaLink="false">http://twycf.com/wordpress/archives/56</guid>
		<description><![CDATA[Nopam是一套號稱無痛式垃圾郵件過濾系統，為了標榜他的“無痛“，故意取跟 “No Pain“一樣的諧音，是不是真的無痛，我還沒親自體驗，而Nopam 站上的 FAQ 算是滿詳細的，或許下次幫客戶裝機可以改用這一套…
目前還沒有看到玩家拿 NOPAM 和 DSBL或ORDB 來比較，那一個效率比較高(判斷正確率、更新速度、效率)
]]></description>
		<wfw:commentRss>http://twycf.com/wordpress/archives/56/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>不存在現實生活中的 TeraByte NAS(四) &#8211; 消失的密室</title>
		<link>http://twycf.com/wordpress/archives/88</link>
		<comments>http://twycf.com/wordpress/archives/88#comments</comments>
		<pubDate>Thu, 11 May 2006 16:48:21 +0000</pubDate>
		<dc:creator>shinnlu</dc:creator>
				<category><![CDATA[FreeBSD]]></category>

		<guid isPermaLink="false">http://twycf.com/wordpress/archives/88</guid>
		<description><![CDATA[台灣的連戲劇的特色是「歹戲拖棚」…沒想到我的 TeraByte NAS 也落的如此下場
自從上次把 Raid Card 的 Staggered Spin Up 功能開啟後，我的 NAS 系統一直處於停擺的狀態，在向 HighPoint 及 WD 求助未果後，決定直接送修…
沒想到這一送修，修了快一個月才回來，我送修的時間是 2006/4/15，而今天是 2006/5/10，在買這四顆硬碟的時候市價是 4650，今天去把硬碟拿回來時，市價3999元，四顆硬碟總共價差 2600元&#8230;足夠買一顆250GB的硬碟了，只有 Orz能形容我此刻的心情&#8230;
不過值得慶幸的是，送回來的是新品，在這裡要感謝台中漢碩的阿杰…
在(二)裡面有提到容量不符的問題，當初以為是 RAID 在背景 rebuild，而隨著rebuild的進度，系統顯示的容量會隨著增加，但事實證明是錯的。
$ df -hFilesystem&#160; &#160; &#160;Size&#160; &#160; Used&#160; &#160;Avail Capacity&#160; Mounted on/dev/da0s1a&#160; &#160; 496M&#160; &#160; &#160;55M&#160; &#160; 401M&#160; &#160; 12%&#160; &#160; /devfs&#160; &#160; &#160; &#160; &#160; 1.0K&#160; &#160; 1.0K&#160; &#160; &#160; 0B&#160; [...]]]></description>
		<wfw:commentRss>http://twycf.com/wordpress/archives/88/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>利用 nice , renice 指定程式優先權</title>
		<link>http://twycf.com/wordpress/archives/57</link>
		<comments>http://twycf.com/wordpress/archives/57#comments</comments>
		<pubDate>Tue, 09 May 2006 13:04:19 +0000</pubDate>
		<dc:creator>shinnlu</dc:creator>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://twycf.com/wordpress/archives/57</guid>
		<description><![CDATA[在寫這一篇的時候，忽然回想到退伍後的第一份工作，在中華電信帳務機房裡當OP(系統操作員)，這個工作主要內容除了接聽各營業據點的重置電話(終端機當機時需要 reset)、換磁帶以外，調整 job 的優先權是一項極重要的工作，各位可別小看了這項看似不起眼的工作，在帳務機房裡的大型主機裡，CPU Loading 常常是 100%，執行中的 job 經常是5~60支以上，而這些 job 執行時間短的可以是5秒以下，長的可以跑將近一天，而每天要跑的程式大同小異，但有時候會跑一些新方案的計算，所以把所有的工作在當天完成是基本的需求。如果今天跑不完，又累積到明天，會造成惡性循環，最好的情況是在周未可以跑完，最差的情況是所有的 job 全部在等該 job 釋放資源(或是等該 job 的結果)。
所以在一個高負載的 Unix 主機中，調整系統優先權(Priority) 可說是非常重要的一部份，而調整的結果也關係到能不能及時的完成工作，空出更多的 cpu time 來處理其他的 job(或是說釋放出資源給其他 job)
對於一個尚未執行的工作，我們可以用 nice 來指定其優先權
nice -n 15 /usr/local/sbin/smbd
對於一個己經執行的工作，我們則用 renice 來指定優先權
renice -n 15 /usr/local/sbin/smbd
其中的 15 則是指 Nice 值，系統中的 Nice 值可以從 -20 ~ 20，一般的 user 可以調整的範圍從 0 ~ 20，只有 super 可以指定 -20 ~ 0 的值，這個數值越低，則系統優先權越高，反之優先權越低。
對於越重要、需快速處理的工作，我們可以將他的Nice [...]]]></description>
		<wfw:commentRss>http://twycf.com/wordpress/archives/57/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>alias 指令接受參數</title>
		<link>http://twycf.com/wordpress/archives/33</link>
		<comments>http://twycf.com/wordpress/archives/33#comments</comments>
		<pubDate>Sun, 16 Apr 2006 17:43:56 +0000</pubDate>
		<dc:creator>shinnlu</dc:creator>
				<category><![CDATA[FreeBSD]]></category>

		<guid isPermaLink="false">http://twycf.com/wordpress/archives/33</guid>
		<description><![CDATA[操作 FreeBSD 的時候，在shell 下面常常要做切換目錄、查看系統 log的指令，這些指令說長不長，說短也不會很短，所以我們會使用 alias 增加操作系統的速度
alias lm&#160; &#160; &#160; &#160; 'ls -al&#124;more'alias www&#160; &#160; &#160; &#160;'cd /usr/local/www/data;lm'
而一個查看 maillog 的指令如下：
第一種cd /var/log/more maillog第二種more /var/log/maillog
一般來說，筆者看 log 檔通常不會用 more 指令，通常會注意在檔案的尾端，這時候需要使用的是 tail 指令由尾端開始讀取
第一種cd /var/log/tail -n 10 maillog第二種tail -n 10 /var/log/maillog
所以筆者會直接設定一個 alias 直接顯示 log 的尾端 10 行
alias maillog 'tail -n 10 /var/log/maillog'
此時大概有人會想到，每一次都是看尾端10 行，那我要看20行、30行，豈不是要做很多個 alias，或是自己下指令?當然不是，今天查了一下 tcsh 的說明，tcsh 的 alias 是可以接受參數的：
alias maillog [...]]]></description>
		<wfw:commentRss>http://twycf.com/wordpress/archives/33/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenWebMail 與 SASL2 認證設定</title>
		<link>http://twycf.com/wordpress/archives/32</link>
		<comments>http://twycf.com/wordpress/archives/32#comments</comments>
		<pubDate>Sun, 16 Apr 2006 17:03:11 +0000</pubDate>
		<dc:creator>shinnlu</dc:creator>
				<category><![CDATA[FreeBSD]]></category>

		<guid isPermaLink="false">http://twycf.com/wordpress/archives/32</guid>
		<description><![CDATA[由於郵件系統有設定 SASL2 的關係，導致 OpenWebMail 無法正確寄出信件，原因是 OpenWebMail 在寄信的時候無法通過 SASL2 的 Relay check，錯誤訊息如下：
Wed Apr 12 14:30:22 2006 - [550] (192.168.1.??) danny - send message error - smtp error ...&#160;&#62;&#62;&#62; Net::SMTP(2.29)&#160;&#62;&#62;&#62;&#160; &#160;Net::Cmd(2.26)&#160;&#62;&#62;&#62;&#160; &#160; &#160;Exporter(5.58)&#160;&#62;&#62;&#62;&#160; &#160;IO::Socket::INET(1.29)&#160;&#62;&#62;&#62;&#160; &#160; &#160;IO::Socket(1.29)&#160;&#62;&#62;&#62;&#160; &#160; &#160; &#160;IO::Handle(1.25)&#160;&#60;&#60;&#60; 220 ns1.yourhost.com ESMTP Postfix&#160;&#62;&#62;&#62; EHLO ns1.yourhost.com&#160;&#60;&#60;&#60; 250-ns1.yourhost.com&#160;&#60;&#60;&#60; 250-PIPELINING&#160;&#60;&#60;&#60; 250-SIZE 10240000&#160;&#60;&#60;&#60; 250-ETRN&#160;&#60;&#60;&#60; 250-AUTH NTLM LOGIN PLAIN OTP DIGEST-MD5 CRAM-MD5&#160;&#60;&#60;&#60; [...]]]></description>
		<wfw:commentRss>http://twycf.com/wordpress/archives/32/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

