<?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>SpaLinux.com &#187; Console</title>
	<atom:link href="http://spalinux.com/category/console/feed" rel="self" type="application/rss+xml" />
	<link>http://spalinux.com</link>
	<description>Resources for Relaxing Linux System Administrators</description>
	<lastBuildDate>Sat, 21 Jan 2012 16:07:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>ดักจับ Traffic ใน Network ด้วย tcpdump</title>
		<link>http://spalinux.com/2011/06/using_tcpdump_to_capture_traffic_on_network</link>
		<comments>http://spalinux.com/2011/06/using_tcpdump_to_capture_traffic_on_network#comments</comments>
		<pubDate>Fri, 03 Jun 2011 14:44:19 +0000</pubDate>
		<dc:creator>editor</dc:creator>
				<category><![CDATA[Console]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Sniffer]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[tcpdump]]></category>

		<guid isPermaLink="false">http://spalinux.com/?p=1351</guid>
		<description><![CDATA[tcpdump เป็นโปรแกรมประเภทเดียวกับ Sniffer, Wireshark คือใช้ในการดักจับ (capture) Traffic หรือ Packet ที่ รับ/ส่ง เข้า/ออก ระหว่างพอร์ตแลน (LAN) ของเซิรฟ์เวอร์เครื่องที่รันคำสั่ง และอุปกรณ์เครือข่าย (Router, Switch, HUB) มีประโยชน์อย่างมาก เพื่อใช้ในการวิเคราะห์ ตรวจสอบ หรือแก้ปัญหาเกี่ยวกับ Network ได้ tcpdump ต้องรันด้วย root หรือเทียบเท่า และรันแบบ command line ติดตั้งมาเป็นดีฟอลต์บนลีนุกซ์เกือบทุกตระกูล เวอร์ชั่น จึงใช้งานได้สะดวก ไม่ต้องติดตั้งเพิ่มเติมเหมือนโปรแกรมอื่นๆ ในที่นี้ขอแนะนำวิธีการใช้งานเบื้องต้นของ tcpdump รันคำสั่ง tcpdump ล็อกอินเป็น root แล้วพิมพ์คำสั่ง tcpdump หมายเหตุ พอร์ตที่ใช้ในดักจับ packet ไม่จำเป็นต้องใส่ IP Address หรือเป็น IP ในกลุ่มเดียวกับ IP อื่นๆ [...]]]></description>
			<content:encoded><![CDATA[<p>tcpdump เป็นโปรแกรมประเภทเดียวกับ Sniffer, Wireshark คือใช้ในการดักจับ (capture) Traffic หรือ Packet ที่ รับ/ส่ง เข้า/ออก ระหว่างพอร์ตแลน (LAN) ของเซิรฟ์เวอร์เครื่องที่รันคำสั่ง และอุปกรณ์เครือข่าย (Router, Switch, HUB)</p>
<p>มีประโยชน์อย่างมาก เพื่อใช้ในการวิเคราะห์ ตรวจสอบ หรือแก้ปัญหาเกี่ยวกับ Network ได้</p>
<p>tcpdump ต้องรันด้วย root หรือเทียบเท่า และรันแบบ command line ติดตั้งมาเป็นดีฟอลต์บนลีนุกซ์เกือบทุกตระกูล เวอร์ชั่น จึงใช้งานได้สะดวก ไม่ต้องติดตั้งเพิ่มเติมเหมือนโปรแกรมอื่นๆ</p>
<p>ในที่นี้ขอแนะนำวิธีการใช้งานเบื้องต้นของ tcpdump</p>
<h4><span id="more-1351"></span><br />
รันคำสั่ง tcpdump</h4>
<p>ล็อกอินเป็น root แล้วพิมพ์คำสั่ง tcpdump</p>
<p><strong>หมายเหตุ</strong> พอร์ตที่ใช้ในดักจับ packet ไม่จำเป็นต้องใส่ IP Address หรือเป็น IP ในกลุ่มเดียวกับ IP อื่นๆ ใน Network ที่ต้องการดักจับ ขอให้สถานะ Up พอ</p>
<p>หากไม่ระบุออปชั่นใดๆ เลย tcpdump จะเลือกดักจับ packet ที่เข้าออก พอร์ตแลนแรก โดยทั่วไปคือ eth0</p>
<p>ตัวอย่างการรันคำสั่งแบบไม่ระบุออปชั่น</p>
<pre>[root@server ~]# <strong>tcpdump
</strong>tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
09:15:53.948422 IP 192.168.1.102.jwalkserver &gt; server.example.com.ssh: Flags [.], ack 1108, win 64623, length 0
09:15:53.955117 IP server.example.com.ssh &gt; 192.168.1.102.jwalkserver: Flags [P.], seq 1108:1384, ack 1, win 8576, length 276
09:15:53.963948 IP server.example.com.ssh &gt; 192.168.1.102.jwalkserver: Flags [P.], seq 1384:1548, ack 1, win 8576, length 164
09:15:53.964191 IP 192.168.1.102.jwalkserver &gt; server.example.com.ssh: Flags [.], ack 1548, win 64183, length 0
09:15:53.972707 IP server.example.com.ssh &gt; 192.168.1.102.jwalkserver: Flags [P.], seq 1548:1824, ack 1, win 8576, length 276
<span style="color: #ff0000;"><strong>^C</strong></span></pre>
<pre>102 packets captured
102 packets received by filter
0 packets dropped by kernel</pre>
<p>กด [Ctrl-C] เพื่อออกจากคำสั่ง tcpdump ด้านล่างจะมีรายงานสรุปว่า ดักจับได้กี่ packet</p>
<p>ผลลัพธ์ที่แสดงจากคำสั่ง tcpdump จะแตกต่างกันไปขึ้นกับ Network Protocol ที่รับ/ส่ง เช่นถ้าเป็น IP Protocol (TCP, UDP) รูปแบบจะเป็น</p>
<ul>
<li>เวลา</li>
<li>IP</li>
<li>[Source IP Address].[Source Port]</li>
<li>[Destination Address].[Destination Port]</li>
<li>IP, TCP, UDP Headers</li>
</ul>
<p> </p>
<h4>เลือกพอร์ตที่ดักจับ</h4>
<p>ระบุออปชั่น &#8220;-i&#8221; แล้วตามด้วยชื่อพอร์ต เช่น ต้องการจับ packet ที่เข้าออก eth1</p>
<pre>[root@server ~]# <strong>tcpdump -i eth1
</strong>tcpdump: WARNING: eth1: no IPv4 address assigned
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth1, link-type EN10MB (Ethernet), capture size 65535 bytes
<span style="color: #ff0000;"><strong>^C</strong></span></pre>
<p>ในที่นี้ พอร์ต eth1 ไม่มีการใส่ IP Address จึงขึ้นฟ้อง &#8220;WARNING: eth1: no IPv4 address assigned&#8221; แต่ก็ยังสามารถดักจับ Traffic ได้</p>
<h4>ไม่ต้องแปลง IP เป็นชื่อ hostname</h4>
<p>ผลลัพธ์ที่แสดงออกมา โปรแกรม tcpdump จะพยายามแปลง IP Address ทั้งต้นทาง ปลายทาง ของ packet ที่ดักจับได้ ให้เป็นชื่อ hostname โดยใช้ไฟล์ /etc/hosts หรือ บริการ DNS</p>
<p>ถ้าหาก traffic มีปริมาณมาก แนะนำให้ปิดคุณสมบัติการพยายามแปลง IP เป็น ชื่อ hostname ออกซะ ด้วยการระบุออปชั่น &#8220;-n&#8221; เพื่อลดโหลด DNS</p>
<pre>[root@server ~]# <strong>tcpdump -i eth0 -l -n
</strong>tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
09:31:10.322145 IP 192.168.1.1.ssh &gt; 192.168.1.102.jwalkserver: Flags [P.], seq 1901277915:1901278111, ack 2244887520, win 8576, length 196
09:31:10.322752 IP 192.168.1.102.jwalkserver &gt; 192.168.1.1.ssh: Flags [.], ack 196, win 65535, length 0
09:31:10.330843 IP 192.168.1.1.ssh &gt; 192.168.1.102.jwalkserver: Flags [P.], seq 196:472, ack 1, win 8576, length 276
09:31:10.332785 IP 192.168.1.1.ssh &gt; 192.168.1.102.jwalkserver: Flags [P.], seq 472:636, ack 1, win 8576, length 164
09:31:10.333209 IP 192.168.1.102.jwalkserver &gt; 192.168.1.1.ssh: Flags [.], ack 636, win 65095, length 0
<span style="color: #ff0000;">^C</span></pre>
<p> </p>
<h4>ไม่ต้องแปลง Port Number เป็นชื่อ Port Name</h4>
<p>หากต้องการแสดงชื่อพอร์ต (TCP, UDP ports) เป็นตัวเลข (ไฟล์ /etc/services)  ให้ระบุออปชั่น &#8220;-n&#8221; เพิ่มอีกหนึ่ง หรือระบุเป็น &#8220;-nn&#8221; เลย</p>
<pre>[root@server ~]# <strong>tcpdump -i eth0 -l -nn
</strong>tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
09:39:38.800430 IP 192.168.1.102.1289 &gt; 192.168.1.1.22: Flags [.], ack 196, win 65535, length 0
09:39:38.802793 IP 192.168.1.1.22 &gt; 192.168.1.102.1289: Flags [P.], seq 196:456, ack 1, win 8576, length 260
09:39:38.805709 IP 192.168.1.1.22 &gt; 192.168.1.102.1289: Flags [P.], seq 456:604, ack 1, win 8576, length 148
09:39:38.805963 IP 192.168.1.102.1289 &gt; 192.168.1.1.22: Flags [.], ack 604, win 65127, length 0
09:39:38.808655 IP 192.168.1.1.22 &gt; 192.168.1.102.1289: Flags [P.], seq 604:848, ack 1, win 8576, length 244
<span style="color: #ff0000;"><strong>^C</strong></span></pre>
<h4>ผลลัพธ์แบบสั้นๆ </h4>
<p>หากไม่สนใจ ข้อมูลใน IP, TCP, UDP Headers ต้องการรู้แค่ว่า IP อะไรคุยกัน ใช้พอร์ตอะไร แค่นั้นพอ ให้ระบุออปชั่น &#8220;-q&#8221;</p>
<pre>[root@server ~]# <strong>tcpdump -i eth0 -l -nn -q
</strong>tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
09:40:48.472427 IP 192.168.1.1.22 &gt; 192.168.1.102.1289: tcp 196
09:40:48.473006 IP 192.168.1.102.1289 &gt; 192.168.1.1.22: tcp 0
09:40:48.479252 IP 192.168.1.1.22 &gt; 192.168.1.102.1289: tcp 164
09:40:48.487003 IP 192.168.1.1.22 &gt; 192.168.1.102.1289: tcp 100
09:40:48.487311 IP 192.168.1.102.1289 &gt; 192.168.1.1.22: tcp 0
<span style="color: #ff0000;"><strong>^C</strong></span></pre>
<p> </p>
<h4>แสดงข้อมูล Layer 2 (MAC Address)</h4>
<p>ระบุออปชั่น &#8220;-e&#8221;  หากต้องการแสดงข้อมูล Layer 2 หรือแสดง Source, Destination MAC Address ด้วย</p>
<pre>[root@server ~]# <strong>tcpdump -i eth0 -l -nn -e -q
</strong>tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
09:44:05.644395 00:11:22:33:44:55 &gt; 00:55:66:77:88:99, IPv4, length 250: 192.168.1.1.22 &gt; 192.168.1.102.1289: tcp 196
09:44:05.644959 00:55:66:77:88:99 &gt; 00:11:22:33:44:55, IPv4, length 60: 192.168.1.102.1289 &gt; 192.168.1.1.22: tcp 0
09:44:05.652121 00:11:22:33:44:55 &gt; 00:55:66:77:88:99, IPv4, length 314: 192.168.1.1.22 &gt; 192.168.1.102.1289: tcp 260
09:44:05.660897 00:11:22:33:44:55 &gt; 00:55:66:77:88:99, IPv4, length 218: 192.168.1.1.22 &gt; 192.168.1.102.1289: tcp 164
09:44:05.661173 00:55:66:77:88:99 &gt; 00:11:22:33:44:55, IPv4, length 60: 192.168.1.102.1289 &gt; 192.168.1.1.22: tcp 0
<span style="color: #ff0000;"><strong>^C</strong></span></pre>
<h4> <br />
save ผลลัพธ์เก็บในไฟล์</h4>
<p>หากต้องการบันทึก (save) ผลลัพธ์ที่ดักจับได้ ให้เหมือนกับหน้าจอที่แสดงขึ้นมา ก็ใช้การ redirection</p>
<p>ตัวอย่าง การเก็บผลลัพธ์ลงไฟล์ ให้เหมือนกับที่แสดงขึ้นมา</p>
<pre>[root@server ~]# <strong>tcpdump -i eth0 -l -nn -q &gt; catpure-display.log
</strong>tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
<span style="color: #ff0000;"><strong>^C</strong></span>
7 packets captured
7 packets received by filter
0 packets dropped by kernel</pre>
<pre>หากต้องการหยุด ก็กดปุ่ม [Ctrl-C] เหมือนกัน</pre>
<p>ใช้คำสั่ง cat เพื่อดูเนื้อหาไฟล์ที่บันทึก</p>
<pre>[root@server ~]# <strong>cat capture-display.log
</strong>09:57:08.118314 IP 192.168.1.1.22 &gt; 192.168.1.102.1289: tcp 196
09:57:08.118515 IP 192.168.1.102.1289 &gt; 192.168.1.1.22: tcp 0
09:57:09.138258 IP 192.168.1.102.1289 &gt; 192.168.1.1.22: tcp 36
09:57:09.355761 IP 192.168.1.102.1289 &gt; 192.168.1.1.22: tcp 36
09:57:09.356025 IP 192.168.1.1.22 &gt; 192.168.1.102.1289: tcp 0
<span style="color: #ff0000;"><strong>^C</strong></span></pre>
<p> แต่ถ้าต้องการบันทึกแบบเต็มรูปแบบ ให้ใช้ออปชั่น &#8220;-w&#8221; แล้วตามด้วยชื่อไฟล์ โดยทั่วไปนิยมบันทึกเป็นไฟล์นามสกุล &#8220;.cap&#8221;</p>
<pre>[root@server ~]# <strong>tcpdump -i eth0 -w capture-raw.cap
</strong>tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
<strong><span style="color: #ff0000;">^C</span></strong>
24 packets captured
24 packets received by filter
0 packets dropped by kernel</pre>
<p>ไฟล์ที่บันทึกด้วยออปชั่น &#8220;-w&#8221; สามารถนำมาเปิดย้อนหลังด้วยคำสั่ง tcpdump ตามด้วยออปชั่น &#8220;-r&#8221;  นอกจากนี้ ยังสามารถนำไปเปิดกับโปรแกรม Wireshark ได้อีกด้วย</p>
<pre>[root@server ~]# <strong>tcpdump -r capture-raw.cap -l -nn
</strong>reading from file capture-raw.cap, link-type EN10MB (Ethernet)
10:00:14.959339 IP 192.168.1.102.1289 &gt; 192.168.1.1.22: Flags [P.], seq 105:157, ack 236, win 65431, length 52
10:00:14.972070 IP 192.168.1.1.22 &gt; 192.168.1.102.1289: Flags [P.], seq 236:288, ack 157, win 8576, length 52
10:00:15.137079 IP 192.168.1.102.1289 &gt; 192.168.1.1.22: Flags [.], ack 288, win 65379, length 0
10:00:15.221339 IP 192.168.1.102.1289 &gt; 192.168.1.1.22: Flags [P.], seq 157:209, ack 288, win 65379, length 52
10:00:15.227905 IP 192.168.1.1.22 &gt; 192.168.1.102.1289: Flags [P.], seq 288:340, ack 209, win 8576, length 52
<span style="color: #ff0000;"><strong>^C</strong></span></pre>
<h4>ข้อมูลอ้างอิง</h4>
<ul>
<li><a href="http://spalinux.com/2008/09/verify_lan_network_interface_status_on_linux">ตรวจสอบสถานะของการ์ดเน็ตเวิร์กบนลีนุกซ์</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://spalinux.com/2011/06/using_tcpdump_to_capture_traffic_on_network/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>วิธีการใช้คำสั่ง wget</title>
		<link>http://spalinux.com/2010/01/using_wget</link>
		<comments>http://spalinux.com/2010/01/using_wget#comments</comments>
		<pubDate>Fri, 22 Jan 2010 08:04:48 +0000</pubDate>
		<dc:creator>editor</dc:creator>
				<category><![CDATA[Console]]></category>
		<category><![CDATA[Proxy]]></category>
		<category><![CDATA[Web Server]]></category>
		<category><![CDATA[wget]]></category>

		<guid isPermaLink="false">http://spalinux.com/?p=1047</guid>
		<description><![CDATA[wget เป็นโปรแกรมที่ใช้เพื่อดาวน์โหลดไฟล์จากเว็บไซต์ได้ ในรูปแบบ text console วิธีการใช้งานก็ง่ายคือรันคำสั่ง wget ตามด้วย URL ที่ต้องการดาวน์โหลด ผลลัพธ์ที่ได้จะถูกบันทึกเป็นไฟล์ของเว็บเพจหน้านั้นๆ รูปแบบการใช้งาน $ wget [option]... [URL]... ตัวอย่างเช่น ต้องการดาวน์โหลดเว็บเพจหน้าแรกของ www.google.co.th $ wget 'http://www.google.co.th' --13:52:23--  http://www.google.co.th/            =&#62; `index.html' Resolving www.google.co.th... 72.14.203.147, 72.14.203.103, 72.14.203.104, ... Connecting to www.google.co.th&#124;72.14.203.147&#124;:80... connected. HTTP request sent, awaiting response... 200 OK Length: unspecified [text/html]     [  &#60;=&#62;                                                                                ] 6,726         11.96K/s 13:52:24 (11.96 [...]]]></description>
			<content:encoded><![CDATA[<p>wget เป็นโปรแกรมที่ใช้เพื่อดาวน์โหลดไฟล์จากเว็บไซต์ได้ ในรูปแบบ text console วิธีการใช้งานก็ง่ายคือรันคำสั่ง wget ตามด้วย URL ที่ต้องการดาวน์โหลด ผลลัพธ์ที่ได้จะถูกบันทึกเป็นไฟล์ของเว็บเพจหน้านั้นๆ</p>
<p><span id="more-1047"></span></p>
<h4>รูปแบบการใช้งาน</h4>
<pre>$ <strong>wget</strong> [option]... [URL]...</pre>
<p>ตัวอย่างเช่น ต้องการดาวน์โหลดเว็บเพจหน้าแรกของ www.google.co.th</p>
<pre>$ <strong>wget 'http://www.google.co.th'
</strong>--13:52:23--  http://www.google.co.th/
           =&gt; `index.html'
Resolving www.google.co.th... 72.14.203.147, 72.14.203.103, 72.14.203.104, ...
Connecting to www.google.co.th|72.14.203.147|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]</pre>
<pre>    [  &lt;=&gt;                                                                                ] 6,726         11.96K/s</pre>
<pre>13:52:24 (11.96 KB/s) - `<span style="color: #0000ff;">index.html</span>' saved [6726]</pre>
<p>จากตัวอย่าง ผลลัพธ์ที่ได้จะถูกบันทึกเป็นชื่อ index.html</p>
<p>หมายเหตุ แนะนำให้ใส่เครื่องหมายคำพูด &#8216;  คลอบ URL เพราะบางตัวอักษรอาจมีความหมายใน SHELL</p>
<pre>$ <strong>cat index.html
</strong>&lt;!doctype html&gt;&lt;html&gt;&lt;head&gt;&lt;meta http-equiv="content-type" content="text/html; charset=windows-874"&gt;&lt;title&gt;Google&lt;/title&gt;
...</pre>
<p>ระบุออปชั่น &#8216;&#8211;help&#8217; เพื่อดูวิธีการใช้งาน พร้อมทั้งออปชั่นต่างๆ</p>
<pre>$ <strong>wget --help
</strong>GNU Wget 1.10.2 (Red Hat modified), a non-interactive network retriever.
Usage: wget [OPTION]... [URL]...</pre>
<pre>Mandatory arguments to long options are mandatory for short options too.</pre>
<pre>Startup:
  -V,  --version           display the version of Wget and exit.
  -h,  --help              print this help.
  -b,  --background        go to background after startup.
  -e,  --execute=COMMAND   execute a `.wgetrc'-style command.</pre>
<p>ในบทความนี้ขอแนะนำการใช้ออปชั่นที่ผู้เขียนใช้บ่อยๆ</p>
<h4>ดูรายละเอียดการโหลด (debug)</h4>
<p>ระบุออปชั่น &#8216;-d&#8217; เพื่อดูรายละเอียดการดาวน์โหลด เช่นดู HTTP Header, Protocol, Cookie ที่เกิดขึ้นในการดาวน์โหลด</p>
<pre>$ <strong>wget -d 'http://www.google.co.th'
</strong>DEBUG output created by Wget 1.10.2 (Red Hat modified) on linux-gnu.</pre>
<pre>--14:16:24--  http://www.google.co.th/
           =&gt; `index.html'
Resolving www.google.co.th... 72.14.203.105, 72.14.203.106, 72.14.203.99, ...
Caching www.google.co.th =&gt; 72.14.203.105 72.14.203.106 72.14.203.99 72.14.203.104 72.14.203.103 72.14.203.147
Connecting to www.google.co.th|72.14.203.105|:80... connected.
Created socket 3.
Releasing 0x000000000083d390 (new refcount 1).</pre>
<pre>---request begin---
GET / HTTP/1.0
User-Agent: Wget/1.10.2 (Red Hat modified)
Accept: */*
Host: www.google.co.th
Connection: Keep-Alive</pre>
<pre>---request end---
HTTP request sent, awaiting response...
---response begin---
HTTP/1.0 200 OK
Date: Fri, 22 Jan 2010 07:16:29 GMT
Expires: -1
Cache-Control: private, max-age=0
Content-Type: text/html; charset=windows-874
Set-Cookie: PREF=ID=79a6955a36392a2d:TM=1264144589:LM=1264144589:S=c99kK7cOeBwCp4KG; expires=Sun, 22-Jan-2012 07:16:29 GMT; path                                             =/;</pre>
<pre>domain=.google.co.th
Set-Cookie: NID=31=h8-gos7iGB-MXzlXOo4C1_CRqzSNE6wu5Os2WBu6C-jm7tPhrlj4kJp1aiENCM66f388IScBzce4Q-6x7rwbfxUUbp2DGAIcxXu1zwSGy6zKH                                            </pre>
<pre>cjUQ2_59hiym_wuaRt2; expires=Sat, 24-Jul-2010 07:16:29 GMT; path=/; domain=.google.co.th; HttpOnly
Server: gws
X-XSS-Protection: 0</pre>
<pre>---response end---
200 OK
cdm: 1 2 3 4 5 6 7 8
Stored cookie google.co.th -1 (ANY) / &lt;permanent&gt; &lt;insecure&gt; [expiry 2012-01-22 14:16:29] PREF ID=79a6955a36392a2d:TM=1264144589                                            </pre>
<pre>:LM=1264144589:S=c99kK7cOeBwCp4KG
cdm: 1 2 3 4 5 6 7 8
Stored cookie google.co.th -1 (ANY) / &lt;permanent&gt; &lt;insecure&gt; [expiry 2010-07-24 14:16:29] NID 31=h8-gos7iGB-MXzlXOo4C1_CRqzSNE6w                                            </pre>
<pre>u5Os2WBu6C-jm7tPhrlj4kJp1aiENCM66f388IScBzce4Q-6x7rwbfxUUbp2DGAIcxXu1zwSGy6zKHcjUQ2_59hiym_wuaRt2
Length: unspecified [text/html]</pre>
<pre>    [  &lt;=&gt;                                                                                ] 6,702          6.21K/s</pre>
<pre>Closed fd 3
14:16:31 (6.20 KB/s) - `index.html' saved [6702]</pre>
<h4>ดาวน์โหลดต่อไฟล์ (continue)</h4>
<p>สามารถดาวน์โหลดไฟล์ต่อจากที่ดาวน์โหลดยังไม่ครบได้</p>
<p>เช่นต้องการดาวน์โหลดไฟล์ iso ที่มีขนาดใหญ่มาก แล้วดาวน์โหลดครั้งแรกยังไม่ครบ</p>
<pre>$ <strong>wget 'http://www.mirror.in.th/osarchive/fedora/releases/11/Live/x86_64/Fedora-11-x86_64-Live.iso'
</strong>--14:09:51--  http://www.mirror.in.th/osarchive/fedora/releases/11/Live/x86_64/Fedora-11-x86_64-Live.iso
           =&gt; `Fedora-11-x86_64-Live.iso'
Resolving <a href="http://www.mirror.in.th/">www.mirror.in.th</a>... 61.7.253.242
Connecting to www.mirror.in.th|61.7.253.242|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 724,097,024 (691M) [application/octet-stream]</pre>
<pre> 0% [                                                                                     ] 1,090,066     87.82K/s  ETA 2:13:52</pre>
<p>หมายเหตุ ในระหว่างการดาวน์โหลด หากต้องการยกเลิกให้กด [Ctrl-C]</p>
<p>ครั้งแรกดาวน์โหลดไฟล์ได้แค่ 1 Meg กว่าๆ</p>
<pre>$ <strong>ls -l
</strong>total 1080
-rw-r--r-- 1 user1  users  1098754 2010-01-22 14:10 Fedora-11-x86_64-Live.iso</pre>
<p>ถ้าต้องการดาวน์โหลดต่อ ต้องระบุออปชั่น &#8216;-c&#8217;</p>
<pre>$ <strong>wget -c 'http://www.mirror.in.th/osarchive/fedora/releases/11/Live/x86_64/Fedora-11-x86_64-Live.iso'
</strong>--14:11:46--  http://www.mirror.in.th/osarchive/fedora/releases/11/Live/x86_64/Fedora-11-x86_64-Live.iso
           =&gt; `Fedora-11-x86_64-Live.iso'
Resolving www.mirror.in.th... 61.7.253.242
Connecting to www.mirror.in.th|61.7.253.242|:80... connected.
HTTP request sent, awaiting response... 206 <span style="color: #0000ff;">Partial Content</span>
Length: 724,097,024 (691M), 722,998,270 (690M) remaining [application/octet-stream]</pre>
<pre> 0% [                                                                                     ] 1,401,045     94.59K/s  ETA 2:04:50</pre>
<pre>$ <strong>ls -l
</strong>total 1384
-rw-r--r-- 1 user1  users  1409733 2010-01-22 14:11 Fedora-11-x86_64-Live.iso</pre>
<h4>จำกัดความเร็วการโหลด</h4>
<p>ต้องการโหลดไฟล์แต่ไม่ต้องการเบียดบังความเร็วการใช้อินเตอร์เน็ตจากคนอื่นมากเกินไป เราสามารถจำกัดความเร็วในการโหลดของเราได้ ด้วยออปชั่น &#8216;&#8211;limit-rate&#8217;</p>
<p>เช่นต้องการจำกัดไว้ที่ 10 KBytes/s</p>
<pre>$ <strong>wget --limit-rate 10000 'http://www.mirror.in.th/osarchive/fedora/releases/11/Live/x86_64/Fedora-11-x86_64-Live.iso'
</strong>--14:25:14--  http://www.mirror.in.th/osarchive/fedora/releases/11/Live/x86_64/Fedora-11-x86_64-Live.iso
           =&gt; `Fedora-11-x86_64-Live.iso'
Resolving www.mirror.in.th... 61.7.253.242
Connecting to www.mirror.in.th|61.7.253.242|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 724,097,024 (691M) [application/octet-stream]</pre>
<pre> 0% [                                                                                     ] 62,618         9.77K/s ETA 20:07:01</pre>
<p>หมายเหตุ หน่วยของออปชั่น &#8216;&#8211;limit-rate&#8217; เป็น bytes per second</p>
<h4>โหลดผ่าน proxy</h4>
<p>หากต้องใช้ proxy ในการโหลด ต้องมีการระบุตัวแปร &#8216;http_proxy&#8217; ไว้ใน shell ก่อนรันคำสั่ง เช่น IP ของ proxy คือ 192.168.1.1 และพอร์ต proxy คือ 3128 ถ้าใช้ BASH สามารถทำได้โดย</p>
<pre>$ <strong>export http_proxy=http://192.168.1.1:3128</strong></pre>
<p>ใช้คำสั่ง wget พร้อมระบุออปชั่น &#8216;&#8211;proxy&#8217; เพื่อให้โหลดผ่าน proxy</p>
<pre>$ <strong>wget --proxy 'http://www.mirror.in.th/osarchive/fedora/releases/11/Live/x86_64/Fedora-11-x86_64-Live.iso'
</strong>--2010-01-22 14:30:26--  http://www.mirror.in.th/osarchive/fedora/releases/11/Live/x86_64/Fedora-11-x86_64-Live.iso
Connecting to 192.168.1.1:3128... connected.
Proxy request sent, awaiting response... 200 OK
Length: 724097024 (691M) [application/octet-stream]
Saving to: `Fedora-11-x86_64-Live.iso'</pre>
<pre> 0% [                                                                                     ] 63,434      96.4K/s</pre>
<p>แต่ถ้า proxy ต้องระบุ user, password ด้วย จะขึ้น error ดังนี้</p>
<pre>$ <strong>wget --proxy  'http://www.mirror.in.th/osarchive/fedora/releases/11/Live/x86_64/Fedora-11-x86_64-Live.iso'
</strong>--2010-01-22 14:31:06--  http://www.mirror.in.th/osarchive/fedora/releases/11/Live/x86_64/Fedora-11-x86_64-Live.iso
Connecting to 192.168.1.1:3128... connected.
Proxy request sent, awaiting response... 407 Proxy Authentication Required
2010-01-22 14:31:06 ERROR 407: Proxy Authentication Required.</pre>
<pre>ใช้ออปชั่น '--proxy-user' และ '--proxy-password' เพื่อระบุ user, password ในการใช้ proxy</pre>
<pre>$ <strong>wget --proxy-user=prxuser --proxy-password=prx1234  'http://www.mirror.in.th/osarchive/fedora/releases/11/Live/x86_64/Fedora-11-x86_64-Live.iso'
</strong>--2010-01-22 14:30:26--  http://www.mirror.in.th/osarchive/fedora/releases/11/Live/x86_64/Fedora-11-x86_64-Live.iso
Connecting to 192.168.1.1:3128... connected.
Proxy request sent, awaiting response... 200 OK
Length: 724097024 (691M) [application/octet-stream]
Saving to: `Fedora-11-x86_64-Live.iso'</pre>
<pre> 0% [                                                                                     ] 63,434      96.4K/s</pre>
<h4>ไฟล์คอนฟิก .wgetrc</h4>
<p>แทนที่จะต้องระบุออปชั่น proxy ทุกครั้ง สามารถสร้างเป็นไฟล์คอนฟิกสำหรับใช้คำสั่ง wget โดยสร้างไฟล์ชื่อ .wgetrc (มีเครื่องหมายจุดนำหน้าชื่อไฟล์ด้วย) ไว้ใน HOME ของผู้ใช้งาน</p>
<pre>$ <strong>cat ~/.wgetrc
</strong>http_proxy=http://192.168.1.1:3128/
proxy_user=prxuser
proxy_password=prx1234</pre>
<p>หลังจากสร้างไฟล์คอนฟิก .wgetrc แล้ว เวลาใช้คำสั่ง wget ก็ไม่ต้องระบุออปชั่นใดๆ อีก</p>
<pre>$ <strong>wget  'http://www.mirror.in.th/osarchive/fedora/releases/11/Live/x86_64/Fedora-11-x86_64-Live.iso'
</strong>--2010-01-22 14:37:46--  http://www.mirror.in.th/osarchive/fedora/releases/11/Live/x86_64/Fedora-11-x86_64-Live.iso
Connecting to 192.168.1.1:3128... connected.
Proxy request sent, awaiting response... 200 OK
Length: 724097024 (691M) [application/octet-stream]
Saving to: `Fedora-11-x86_64-Live.iso.1'</pre>
<pre> 0% [                                                                                     ] 80,810      95.8K/s</pre>
<h4>ข้อมูลอ้างอิง</h4>
<ul>
<li><a href="http://www.gnu.org/software/wget/" target="_blank">GNU Wget</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://spalinux.com/2010/01/using_wget/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>ปรับแต่งเครื่องหลังจากติดตั้ง Fedora 9 &#8211; แก้ไขคอนโซล (Text Console)</title>
		<link>http://spalinux.com/2008/09/fedora_9_post_installation_configure_console</link>
		<comments>http://spalinux.com/2008/09/fedora_9_post_installation_configure_console#comments</comments>
		<pubDate>Mon, 08 Sep 2008 16:56:30 +0000</pubDate>
		<dc:creator>editor</dc:creator>
				<category><![CDATA[Console]]></category>
		<category><![CDATA[Linux Installation]]></category>

		<guid isPermaLink="false">http://spalinux.com/?p=140</guid>
		<description><![CDATA[หลายคนเมื่อติดตั้งลินุกซ์เรียบร้อยแล้ว เกิดคำถามว่าทำอะไรต่อดี เริ่มต้นคอนฟิกอย่างไร  ในบทความนี้ขอเริ่มแนะนำคอนฟิกเพื่อการปรับแต่งคอนโซลของเครื่องลินุกซ์ ซึ่งจะมีทั้งปรับแต่งเพื่อความปลอดภัย และประหยัด Memory ที่ใช้ หมายเหตุ คอนโซล ในที่นี้หมายถึง text console ที่แสดงผลในรูปแบบตัวอักษร ไม่ใช่ X Window ยกเลิกการแสดงเวอร์ชั่นของลินุกซ์ผ่านทางหน้าจอคอนโซล (Console) โดยดีฟอลต์แล้วหลังจากการติดตั้ง หน้าจอคอนโซล (Console) ที่รอรับการ login จะแสดงเวอร์ชั่นของลินุกซ์ที่ติดตั้งด้วย โดยข้อความที่แสดงจะนำมาจากไฟล์ /etc/issue ตัวอย่างไฟล์ /etc/issue ที่ติดตั้งมากับ Fedora 9 [root@server ~]# cat /etc/issue Fedora release 9 (Sulphur) Kernel r on an m (l) ตัวอย่างหน้าจอคอนโซลของ Fedora 9 Fedora release 9 (Sulphur) Kernel 2.6.25-14.fc9.i686 [...]]]></description>
			<content:encoded><![CDATA[<p>หลายคนเมื่อติดตั้งลินุกซ์เรียบร้อยแล้ว เกิดคำถามว่าทำอะไรต่อดี เริ่มต้นคอนฟิกอย่างไร  ในบทความนี้ขอเริ่มแนะนำคอนฟิกเพื่อการปรับแต่งคอนโซลของเครื่องลินุกซ์ ซึ่งจะมีทั้งปรับแต่งเพื่อความปลอดภัย และประหยัด Memory ที่ใช้</p>
<p>หมายเหตุ คอนโซล ในที่นี้หมายถึง text console ที่แสดงผลในรูปแบบตัวอักษร ไม่ใช่ X Window</p>
<p><span id="more-140"></span></p>
<h4>ยกเลิกการแสดงเวอร์ชั่นของลินุกซ์ผ่านทางหน้าจอคอนโซล (Console)</h4>
<p>โดยดีฟอลต์แล้วหลังจากการติดตั้ง หน้าจอคอนโซล (Console) ที่รอรับการ login จะแสดงเวอร์ชั่นของลินุกซ์ที่ติดตั้งด้วย โดยข้อความที่แสดงจะนำมาจากไฟล์ /etc/issue</p>
<p>ตัวอย่างไฟล์ /etc/issue ที่ติดตั้งมากับ Fedora 9</p>
<pre>[root@server ~]# <strong>cat /etc/issue
</strong>Fedora release 9 (Sulphur)
Kernel r on an m (l)</pre>
<p>ตัวอย่างหน้าจอคอนโซลของ Fedora 9</p>
<pre>Fedora release 9 (Sulphur)
Kernel 2.6.25-14.fc9.i686 on an i686 (tty1)</pre>
<pre>server login:</pre>
<p>เพื่อความปลอดภัย แนะนำให้แก้ไขข้อความที่แสดงเวอร์ชั่น หรือลบออกไปเลยก็ได้ เมื่อแก้ไขไฟล์เสร็จแล้ว ที่หน้าจอคอนโซล กด [Ctrl – L ] เพื่อให้คอนฟิกใหม่มีผล</p>
<hr />
<h4>ยกเลิกการรันหน้าจอคอนโซลที่ 2 &#8211; 6</h4>
<p>หน้าจอคอนโซลที่ติดตั้งมากับลินุกซ์ตั้งแต่เวอร์ชั่นแรกๆ ตั้งแต่ยังไม่มี X Window จนถึงปัจจุบันนี้ จะมีหน้าจอคอนโซลที่สามารถทำงานพร้อมๆ กันได้ 6 หน้าจอ โดยกดปุ่ม [Alt-Fx] สลับไปมา ระหว่างหน้าจอคอนโซล เช่นต้องการไปหน้าจอที่ 5 ก็กดปุ่ม [Alt-F5]</p>
<p>ในการใช้งานจริงปัจจุบันนี้ ส่วนใหญ่จะทำงานผ่าน X Window ไม่ว่าจะใช้ GNOME หรือ KDE  หรือไม่ก็ใช้การรีโมตเข้าไปเช่นใช้ Secure Shell เป็นต้น ดังนั้นหน้าจอ Console แทบไม่มีความจำเป็นต้องใช้เลย</p>
<p>ดังนั้นแนะนำให้ยกเลิกหน้าจอคอนโซลที่ 2 ถึง 6 ให้เหลือไว้แต่หน้าจอคอนโซลที่ 1 ซึ่งไว้สำหรับการ แก้ไขปัญหา การบู๊ตเครื่องเป็นต้น</p>
<p>ประโยชน์ของการยกเลิกหน้าจอ ก็เพื่อประหยัด Memory ของเครื่องที่ต้องรันโปรแกรมรองรับการ login ผ่านหน้าจอคอนโซลนั่นเอง ถึงแม้จะดูว่ากินเพียงเล็กน้อยเท่านั้น แต่ถ้าไม่ต้องใช้ก็ไม่จำเป็นต้องรัน</p>
<p>ตรวจสอบโปรแกรมที่รันสำหรับรองรับการ login ผ่านคอนโซล<br />
โปรแกรมที่ลินุกซ์ส่วนใหญ่ใช้รันเพื่อรองรับการ login ผ่านหน้าจอคอนโซลนั้น คือ /sbin/mingetty ซึ่งโดยดีฟอลต์แล้วจะรันขึ้นมาทั้งหมด 6 หน้าจอ สามารถใช้คำสั่ง ps เพื่อแสดงปริมาณ Memory ที่ใช้ได้ดังนี้</p>
<pre>[root@server ~]# <strong>ps auxw | egrep "(USER|min)"
</strong>USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root      1592  0.0  0.0   1812   428 tty4     Ss+  00:31   0:00 /sbin/mingetty tty4
root      1593  0.0  0.0   1812   424 tty5     Ss+  00:31   0:00 /sbin/mingetty tty5
root      1594  0.0  0.0   1812   428 tty2     Ss+  00:31   0:00 /sbin/mingetty tty2
root      1595  0.0  0.0   1812   424 tty3     Ss+  00:31   0:00 /sbin/mingetty tty3
root      1596  0.0  0.0   1812   424 tty1     Ss+  00:31   0:00 /sbin/mingetty tty1
root      1597  0.0  0.0   1812   424 tty6     Ss+  00:31   0:00 /sbin/mingetty tty6</pre>
<p>สำหรับไฟล์คอนฟิกที่ใช้ในการควบคุมโปรแกรม /sbin/mingetty อีกทีนั้น จะมีอยู่สองแบบขึ้นอยู่กับเวอร์ชั่นของลินุกซ์ที่ติดตั้ง สำหรับ Fedora นั้น ก่อน Fedora 9 จะใช้ไฟล์คอนฟิก /etc/inittab ในการควบคุม แต่ถ้าเป็นเวอร์ชั่น 9 เป็นต้นมา จะแยกเป็นคอนฟิกไฟล์ย่อยๆ อยู่ใน /etc/event.d/</p>
<h5>การยกเลิกคอนโซล 2-6 สำหรับ Fedora ก่อนเวอร์ชั่น 9</h5>
<p>ต้องเข้าไปแก้ไขไฟล์ /etc/inittab</p>
<p>ตัวอย่างไฟล์ /etc/inittab ในส่วนควบคุม /sbin/mingetty ที่ติดตั้งมากับ Fedora ก่อนเวอร์ชั่น 9</p>
<pre># Run gettys in standard runlevels
1:2345:respawn:/sbin/mingetty tty1
2:2345:respawn:/sbin/mingetty tty2
3:2345:respawn:/sbin/mingetty tty3
4:2345:respawn:/sbin/mingetty tty4
5:2345:respawn:/sbin/mingetty tty5
6:2345:respawn:/sbin/mingetty tty6</pre>
<p>วิธีการแก้ไขให้ใส่เครื่องหมาย # ก่อนหน้าบรรทัดของโปรแกรม /sbin/mingetty ตั้งแต่เลข 2 ถึงเลข 6 หรือจะลบบรรทัดเหล่านี้ทิ้งไปเลยก็ได้ ให้เหลือแต่บรรทัดที่มีเลข 1 นำหน้า</p>
<p>ตัวอย่างไฟล์ /etc/inittab หลังการแก้ไข</p>
<pre># Run gettys in standard runlevels
1:2345:respawn:/sbin/mingetty tty1
#2:2345:respawn:/sbin/mingetty tty2
#3:2345:respawn:/sbin/mingetty tty3
#4:2345:respawn:/sbin/mingetty tty4
#5:2345:respawn:/sbin/mingetty tty5
#6:2345:respawn:/sbin/mingetty tty6</pre>
<p>เมื่อแก้ไขไฟล์ /etc/inittab เสร็จแล้ว ให้รันคำสั่ง init q เพื่อให้โปรเซส init อ่านไฟล์ /etc/inittab ใหม่ ซึ่งจำทำให้คอนโซลที่ 2 – 6 ใช้งานไม่ได้อีกต่อไป</p>
<h5>การยกเลิกคอนโซล 2-6 สำหรับ Fedora 9</h5>
<p>ตั้งแต่ Fedora 9 ไฟล์คอนฟิกของโปรเซส init จะถูกควบคุมด้วย /etc/event.d/ โดยจะมีไฟล์ย่อยๆ ออกจากกัน เช่นไฟล์คอนฟิกสำหรับรันหน้าจอคอนโซลที่ 2 คือไฟล์ /etc/event.d/tty2</p>
<p>ตัวอย่างไฟล์คอนฟิกสำหรับรันหน้าจอคอนโซลที่ 2</p>
<pre>[root@server event.d]# <strong>cat /etc/event.d/tty2
</strong># tty2 - getty
#
# This service maintains a getty on tty2 from the point the system is
# started until it is shut down again.</pre>
<pre>start on stopped rc2
start on stopped rc3
start on stopped rc4
start on started prefdm</pre>
<pre>stop on runlevel 0
stop on runlevel 1
stop on runlevel 6</pre>
<pre>respawn
exec /sbin/mingetty tty2</pre>
<p>วิธีการที่จะยกเลิกหน้าจอคอนโซลได้นั้น ต้องลบไฟล์คอนฟิกเป็นไฟล์ๆ ไป เช่นยกเลิกหน้าจอที่ 2 ก็ลบไฟล์ /etc/event.d/tty2 ออกไป ดังนั้นถ้าต้องการยกเลิกหน้าจอที่ 2 -  6 สามารถทำได้ดังนี้</p>
<pre>[root@server ~]# rm -f /etc/event.d/tty2
[root@server ~]# rm -f /etc/event.d/tty3
[root@server ~]# rm -f /etc/event.d/tty4
[root@server ~]# rm -f /etc/event.d/tty5
[root@server ~]# rm -f /etc/event.d/tty6</pre>
<p>หลังจากลบไฟล์แล้วต้องใช้คำสั่ง initctl เพื่อให้คอนฟิกใหม่มีผล ซึ่งต้องใช้คำสั่ง initctl เพื่อหยุดการรันโปรแกรมที่ละหน้าจอ</p>
<p>ตัวอย่างการรันคำสั่ง initctl เพื่อหยุดการรันโปรแกรมสำหรับหน้าจอคอนโซลที่ 3</p>
<pre>[root@server ~]# initctl stop tty3
tty3 (stop) running, process 1595
tty3 (stop) pre-stop, (main) process 1595
tty3 (stop) stopping, process 1595
tty3 (stop) killed, process 1595
tty3 (stop) post-stop
tty3 (stop) waiting</pre>
<pre>[root@server ~]# initctl status tty3
initctl: Unknown job: tty3</pre>
<p>ใช้คำสั่ง ps ตรวจสอบอีกครั้งหลังจากการยกเลิกหน้าจอที่ 2-6 จะเห็นได้ว่าเหลือแค่โปรเซสเดียวเท่านั้น ไว้รองรับหน้าจอคอนโซลที่ 1 ซึ่งเป็นดีฟอลต์นั่นเอง</p>
<p>คำเตือน ไม่แนะนำให้ลบนะครับหน้าจอคอนโซลที่ 1</p>
<pre>[root@server ~]# ps auxw | egrep "(USER|min)"
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root     11095  0.0  0.0   1812   428 tty1     Ss+  20:16   0:00 /sbin/mingetty tty1</pre>
<hr />
<h4>ยกเลิกการกดปุ่ม [Ctrl-Alt-Del] เพื่อการรีบู๊ตเครื่อง</h4>
<p>หลายคนที่ใช้ Windows บ่อยๆ อาจติดนิสัยกดปุ่ม [Ctrl-Alt-Del] เพื่อทำการล๊อคหน้าจอ หรือเพื่อดู Task Manager ซึ่งถ้าพลาดมากดปุ่มนี้บนหน้าจอคอนโซลของลินุกซ์ โดยดีฟอลต์แล้วจะทำให้เครื่องลินุกซ์ถูกรีบู๊ตไป เป็นอันตรายอย่างยิ่ง ดังนั้นแนะนำให้ยกเลิกคุณสมบัตินี้ออกไป</p>
<p>วิธีการยกเลิกการกดปุ่ม [Ctrl-Alt-Del] เพื่อการรีบู๊ตเครื่องนั้น ทำได้สองวิธีขึ้นอยู่กับเวอร์ชั่นของลินุกซ์ที่ใช้ เช่นเดียวกับการยกเลิกการรันหน้าจอคอนโซล</p>
<h5>ยกเลิกการกดปุ่ม [Ctrl-Alt-Del] เพื่อการรีบู๊ตเครื่อง สำหรับ Fedora ก่อนเวอร์ชั่น 9</h5>
<p>ไฟล์คอนฟิกที่ทำให้เครื่องลินุกซ์ถูกรีบู๊ตเมื่อกดปุ่ม [Ctrl-Alt-Del] จะถูกเก็บอยู่ในไฟล์ /etc/inittab</p>
<p>ตัวอย่างไฟล์คอนฟิก /etc/inittab ในส่วนการกดปุ่ม [Ctrl-Alt-Del]</p>
<pre># Trap CTRL-ALT-DELETE
ca::ctrlaltdel:/sbin/shutdown -t3 -r now</pre>
<p>จากคอนฟิกเมื่อมีการกดปุ่ม [Ctrl-Alt-Del] เครื่องจะรันคำสั่ง shutdown เพื่อรีบู๊ตเครื่อง</p>
<p>การยกเลิกไม่ให้รีบู๊ต ให้แก้ไขไฟล์คอนฟิกนี้ โดยใส่เครื่องหมาย # ก่อนหน้าบรรทัดที่มีคำว่า ca หรือจะลบบรรทัดนี้ทิ้งไปเลยก็ได้เช่นกัน แล้วรันคำสั่ง init q เพื่อให้โปรเซส init อ่านไฟล์ /etc/inittab ใหม่ให้มีผลทันที</p>
<p>ตัวอย่างการแก้ไขไฟล์ /etc/inittab เพื่อไม่ให้รีบู๊ต</p>
<pre># Trap CTRL-ALT-DELETE
#ca::ctrlaltdel:/sbin/shutdown -t3 -r now</pre>
<h5>ยกเลิกการกดปุ่ม [Ctrl-Alt-Del] เพื่อการรีบู๊ตเครื่อง สำหรับ Fedora 9</h5>
<p>ไฟล์คอนฟิกในเวอร์ชั่นนี้จะเก็บแยกเป็นไฟล์ชื่อ /etc/event.d/control-alt-delete</p>
<p>ตัวอย่างไฟล์ /etc/event.d/control-alt-delete</p>
<pre>[root@server event.d]# <strong>cat control-alt-delete
</strong># control-alt-delete - emergency keypress handling
#
# This task is run whenever the Control-Alt-Delete key combination is
# pressed.  Usually used to shut down the machine.</pre>
<pre>start on control-alt-delete</pre>
<pre>exec /sbin/shutdown -r now "Control-Alt-Delete pressed"</pre>
<p>การแก้ไขทำได้โดยลบไฟล์นี้ทิ้งไป และจะมีผลทันที</p>
<pre>[root@server ~]# <strong>initctl status control-alt-delete
</strong>initctl: Unknown job: control-alt-delete</pre>
<p>สามารถทดสอบได้โดยการกดปุ่ม [Ctrl-Alt-Delete] อีกครั้ง เครื่องจะไม่รีบู๊ตอีกต่อไป</p>
]]></content:encoded>
			<wfw:commentRss>http://spalinux.com/2008/09/fedora_9_post_installation_configure_console/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

