linux1

โดย อดิศร  ขาวสังข์
เขียนเมื่อ 07/10/2006
อ้างอิง : http://www.serassio.it/SquidNT.htm
ทดลองบน WindowsXP SP2                

บทนำ
โปรแกรม Web Caching ที่แพร่หลายมากที่สุดก็คือ Squid (Squid Web Proxy Cache) ซึ่งส่วนใหญ่แล้วจะนิยมใช้งานบน Linux หรือ Unix แต่ใครที่ไม่ถนัด  OS ดังกล่าวก็สามารถใช้งานได้เพราะ Squid มีเวอร์ชันที่สามารถรันบน Windows ได้ชื่อว่า SquidNT 

ขั้นตอนการติดตั้ง
1.ดาวน์โหลดโปรแกรม SquidNT จาก http://www.serassio.it/SquidNT.htm ซึ่งในที่นี้ผู้เขียนใช้เวอร์ชัน 2.6.STABLE5-NT 
2.upzip ไฟล์ที่ดาวน์โหลดมาไปไว้ที่ไดเร็คทอรี่ที่ต้องการ ซึ่ง default จะเป็น c:\squid และในที่นี้ผู้เขียนก็ใช้ c:\squid 
3.ตรวจสอบ build options จากไฟล์ docs\CompileOptions.txt 
4.ก็อปปี้และเปลี่ยนชื่อไฟล์ที่อยู่ในไดเร็คทอรี่ etc ดังต่อไปนี้

?squid.conf.default ==> squid.conf 
?mime.conf.default ==> mime.conf 
?cachemgr.conf.default ==> cachemgr.conf 
5.แก้ไขและเปลี่ยนแปลงค่าในไฟล์ squid.conf โดยที่สำคัญคือค่า path ที่เป็น c:/squid ให้ใช้ ''/'' ไม่ใช่ '''' โดยค่าที่ควรแก้ไขในขั้นพื้นฐานประกอบด้วย 
?หาคำว่า visible_hostname และให้ใส่ hostname เข้าไป  ของผู้เขียนใช้คำว่า visible_hostname adisorn 
?ให้เอาเครื่องหมาย ''#'' หน้าคำว่า acl our_networks src และให้ใส่ค่า Network ที่จะอนุญาตให้ใช้งาน ตามหลังคำนี้ให้ตรงกับ Network ของตัวเอง 
?ให้เอาเครื่องหมาย ''#'' หน้าคำว่า  http_access allow our_networks ออก 
6.ไปที่ dos prompt ในตำแหน่ง c:\squid\sbin> แล้วรันคำว่า squid -z โปรแกรมก็จะทำการสร้าง Swap Directories 
7.start การทำงานของ squid ด้วยการพิมพ์คำว่า squid แล้วหน้าจอ dos prompt จะค้างอยู่ซึ่งแสดงว่า squid ทำงานแล้ว 
8.ทดสอบการทำงานโดยการทำงานที่ default จะเป็นพอร์ต 3128 
9.สามารถดูได้ว่ามีการ access ไปยังที่ไหนบ้างได้ที่ไฟล์ var/logs/access.log 
10.ในกรณีต้องการให้ squid เป็น service ของ windows ทำได้ดังนี้ 
?ให้รันคำสั่งที่มีรูปแบบดังนี้ (อยู่ในตำแหน่ง c:\squid\sbin) 
squid -i [-f configfile] [-n servicename]
ซึ่งเป็นการติดตั้ง sevice ที่ชื่อ servicename โดยใช้ configuration file ที่ชื่อ configfile โดยค่า default ของ configfile คือ"c:/squid/etc/squid.conf" ส่วนค่า default ของ servicename คือ "Squid" ซึ่งในที่นี้ผู้เขียนรันเป็น ดังนี้ : 
squid -i -f c:/squid/etc/squid.conf -n Squid 
?ในกรณีต้องการเซ็ต Windows Registry ให้ทำตามคำแนะนำข้างล่างนี้  (สำหรับผู้เขียนไม่ได้ทำข้อนี้เพราะเป็นแค่ทดลอง) 
squid -O servicecommandline [-n servicename] (Set in Windows Registry the Squid servicename service command line) 
11.ในกรณีต้องการลบ service ออกจากระบบ ให้ใช้คำสั่ง squid -r Squid 

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

# CentOS-Base.repo
#
# This file uses a new mirrorlist system developed by Lance Davis for CentOS.
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the #mirrorlist= does not work for you, as a fall back you can try the 
# remarked out baseurl= line instead.
#
#

[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
baseurl=http://mirror1.ku.ac.th/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirror1.ku.ac.th/centos/RPM-GPG-KEY-CentOS-5
# Rpmforge (yum-priority)
# protect=1

#released updates 
[updates]
name=CentOS-$releasever - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
baseurl=http://mirror1.ku.ac.th/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirror1.ku.ac.th/centos/RPM-GPG-KEY-CentOS-5
# Rpmforge (yum-priority)
# protect=1

#packages used/produced in the build but not released
[addons]
name=CentOS-$releasever - Addons
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=addons
baseurl=http://mirror1.ku.ac.th/centos/$releasever/addons/$basearch/
gpgcheck=1
gpgkey=http://mirror1.ku.ac.th/centos/RPM-GPG-KEY-CentOS-5
# Rpmforge (yum-priority)
# protect=0

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
baseurl=http://mirror1.ku.ac.th/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirror1.ku.ac.th/centos/RPM-GPG-KEY-CentOS-5
# Rpmforge (yum-priority)
# protect=0

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
baseurl=http://mirror1.ku.ac.th/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror1.ku.ac.th/centos/RPM-GPG-KEY-CentOS-5
# Rpmforge (yum-priority)
# protect=1

#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
baseurl=http://mirror1.ku.ac.th/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror1.ku.ac.th/centos/RPM-GPG-KEY-CentOS-5
# Rpmforge (yum-priority)
# protect=0
---------------------------------------------------------------------------------------------------------------------------------------------------------

ตรวจสอบสถานะของ MSN Server
http://messenger.msn.com/Status.aspx
ถ้ายังลองไป download จาก web อื่นดูก่อนม๊ายคะ เช่น http://www.kapook.com/msn/

หรือว่า install ได้แล้วแต่ขึ้นเป็น error อ่ะ ถ้าขึ้นเป็น Error  ลองดูตามนี้จ้า  มีวิธีแก้สำหรับบาง error 

ดูจาก Errorcode
ErrorCode : 80048883
1. ให้ไปที่ http://clientconfig.passport.net/ppcrlconfig.bin
2. แล้วโหลดไฟล์นั้นแล้วเปลี่ยนชื่อเป็น ppcrlconfig.dll นะครับ
3. แล้วคลิ๊กขวา copy แล้วไป paste ที่ C:\Documents and Settings\[Windows USER]\Application Data\Microsoft\IdentityCRL
4. แล้วลองเข้าดูครับ

ErrorCode : 80048848
- สาเหตุ: เกิดจากปัญหาของ Firewall หรือการติดต่อออกอินเตอร์เน็ต มีปัญหา
- วิธีแก้: แก้ตามวิธีแก้ที่ 1 และ 2 ครับ

ErrorCode : 81000362
- สาเหตุ: เกิดจากที่ตัว IE เปิด Work OffLine ไว้ครับ
- วิธีแก้: แก้ตามวิธีแก้ที่ 11 ครับ

ErrorCode : 800b001
- สาเหตุ: เกิดจาก MSN หาไฟล์พวก .dll บางตัวไม่เจอ ทำให้ไม่สามารถ sign in ได้
- วิธีแก้: แก้ตามวิธีแก้ที่ 3 คับ

ErrorCode : 80048820
- สาเหตุ: เกิดจากวันที่ของเครื่องไม่ถูกต้อง
- วิธีแก้: แก้ตามวิธีแก้ที่ 3 คับ หรือตั้งวันที่ใหม่ครับ (แนะนำเพิ่มเติมเล็กน้อย)ควรตั้งเวลาที่Biosด้วย

ErrorCode : 80072ee7
- สาเหตุ: เกิดจากปัญหาของ Firewall หรือการติดต่อออกอินเตอร์เน็ต มีปัญหา
- วิธีแก้: แก้ตามวิธีแก้ที่ 1 และ 2 คับ

ErrorCode : 80072eff , 80070193 , 800701f7
- สาเหตุ: เป็นปัญหาจาก .NET Messenger Service มีปัญหา ซึ่งอาจจะเกิดจากตัว .Net server
- วิธีแก้: แก้ตามวิธีแก้ที่ 1 , 2 และ 4 คับ

ErrorCode : 80072efd
- สาเหตุ: ปัญหานี้เกิดจาก ในส่วนของ windows update
- วิธีแก้: แก้ตามวิธีแก้ที่ 1 , 2 , 3 และ 5 คับ

ErrorCode : 80072f0d
- สาเหตุ: เกิดจากที่ส่วนที่เกี่ยวข้องกับ security ของ MSN ไม่ทำงาน
- วิธีแก้: แก้ตามวิธีแก้ที่ 1 , 2 , 3 และ 6 คับ ถ้ายังไม่หายให้เพิ่มข้อ 10 ด้วยคับ

ErrorCode : 80070190
- สาเหตุ: เกิดจากปัญหาการเชื่อมต่ออินเตอร์เน็ต
- วิธีแก้: แก้ตามวิธีแก้ที่ 1 , 2 , 4 และ 3 คับ

ErrorCode : 80070301
- สาเหตุ: เกิดจากปัญหา ของ .NET Messenger Service
- วิธีแก้: แก้ตามวิธีแก้ที่ 1 , 2 , 4 , 7 และ 8 คับ

ErrorCode : 81000303 หรือ " Microsoft .NET Passport has made your account temporarily unavailable to help prevent other users from guessing or obtaining your password."
- สาเหตุ: เกิดจากปัญหา ของ .NET Messenger Service หรือ รหัสผ่านผิด
- วิธีแก้: แก้ตามวิธีแก้ที่ 1 , 2 , 3 ,4 และ 7 คับ

ErrorCode : 81000306
- สาเหตุ: เกิดจากปัญหา ของ .NET Messenger Service หรือ การเชื่อมต่ออินเตอร์เน็ต
- วิธีแก้: แก้ตามวิธีแก้ที่ 1 , 2 , 4 และ 8 คับ

ErrorCode : 81000314
สาเหตุ: ไฟล์ dll บางไฟล์ของ MSN ยังไม่ได้ทำการ Register
วิธีแก้:
- โหลดโปรแกรมนี้ไปแล้วกดเปิดครับ http://www.msn-th.com/downloads/msnallreg.bat
ErrorCode :80072745
สาเหตุ: เกิดจากปัญหาการเชื่อมต่ออินเตอร์เน็ต
วิธีแก้:
- ตรวจเช็ค Internet ว่า Connect อยู่หรือป่าว...
- ปิด Firewall ทั้งของ Windows , Router และโปรแกรม Antivirus ต่างๆ
- Register DLL files และตั้งวันที่ใหม่ โดยใช้ไฟล์นี้คับ http://www.msn-th.com/downloads/msnallreg.bat
- เช็ค .Net Messenger Service server อาจมีปัญหา ลองคลิ๊กที่นี่เพื่อตรวจสอบ http://messenger.msn.com/Status.aspx ว่า Server รันอยู่หรือป่าว
------------------------------------------------------------ --------------------------------------- 

วิธีแก้:
1. ตรวจเช็ค Internet ว่า Connect อยู่หรือป่าว...

2. ปิด Firewall ทั้งของ Windows , Router และโปรแกรม Antivirus ต่างๆ

3. รีเซ็ต Register DLL files ของ MSN และตั้งวันที่ใหม่ โดยใช้ไฟล์นี้คับ
http://board.kailandz.com/download.php?id=2942

4. เช็ค .Net Messenger Service server อาจมีปัญหา ลองคลิ๊กที่นี่เพื่อตรวจสอบ http://messenger.msn.com/Status.aspx ว่า Server รันอยู่หรือป่าว

5. Internet Explorer ต้องสนับสนุน การเข้ารหัสแบบ 128 bit ให้ตรวจสอบ โดยดูได้ด้วยการคลิกเมนู Help->About ใน IE
ถ้าไม่ใช่แนะนำให้ลง IE6 ใหม่อีกรอบคับ

6. เปิด Internet Explorer ไปที่เมนู Options -> Internet Options.. -> Advancd แล้วดูที่หัวข้อ use SSL 2.0 และ use SSL 3.0 ให้ติ๊กถูกทั้ง 2 อัน

7. ให้ตรวจสอบ user name และ password ให้แน่ใจด้วยการกรอกใหม่อีกครั้งระวังตัวพิมพ์เล็กและใหญ่ด้วยน ะคับ

8. ไปที่ Start -> Run พิมพ์ %appdata%\microsoft กด Enter และลบโฟล์เดอร์ชื่อ MSN Messenger (Emo และ DP ที่เพิ่มเข้าไปจะหายไปหมด)

9. อาจถูกบล็อคการใช้งานจากผู้ดูแลระบบ ลองติดต่อ admin คับ

10. ไปที่ Start -> Run พิมพ์ regsvr32 initpki.dll กด Enter แล้วรอครับอาจจะนานหน่อยเป็น 10 นาที...
11. ตรวจเช็คการตั้งค่าใน IE และ MSN

เช็คว่า IE OffLine ไว้หรือป่าว
- เรียก Internet Explorer ขึ้นมาคับ
- กดที่เมนู File แล้วดูที่ Work Offline ว่ามีติ๊กไว้หรือป่าวถ้ามีให้เอาออก
ตรวจเช็คการตั้งค่า Proxy ใน IE
- เรียก Internet Explorer ขึ้นมาคับ
- กดที่เมนู Tools --> Internet Options
- คลิ๊กที่แท็บ Connections กดปุ่ม LAN Settings คับ
- เอาตัวติ๊กทั้งหมดออกคับ
- กด OK 2 ที
ตรวจเช็คการตั้งค่า Proxy ใน MSN
- เรียก MSN Messenger ขึ้นมาคับ
- กดที่เมนู Tools -- Options คับ
- เลือกที่ Connection กดปุ่ม Advanced Settings
- ลบทุกอย่างที่เติมไว้ในบล็อคคับ
- กด OK 2 ที

12. ตรวจเช็คไฟล์ hosts (อาจโดนเปลี่ยนโดย Spyware บางตัว)
- กดที่ Start ---> Run
- พิมพ์ notepad %SystemRoot%\system32\drivers\etc\hosts
- แล้วลบทั้งหมดออกเหลือไว้แต่ 127.0.0.1 , localhost แค่บรรทัดเดียวคับ
- แล้วสั่ง File -->Save แล้วปิดไปเลยคับ

อ้างอิงมาจาก  http://www.thaimsn.net/webboard/question.asp?QID=1135

------------------------------------------------------------------------------------------------------------------------------------------------------------
# 1. คำสั่งแทรกข้อมูลรายชื่อนักเรียน จากตาราง student2 ไปยัง ฐานข้อมูล hotspot ตาราง account
insert into account
select id,'25d55ad283aa400' ,name,surname, '--' , now() ,'md5','1' from wifi.students
หมายเหตุ
name ชื่อคอลัมภ์ ชื่อนักเรียน
surname ชื่อคอมลัมภ์ นามสกุลนักเรียน
wifi คือ =ชื่อฐานข้อมูล
students คือ ชื่อตารางที่มีรายชื่อนักเรียน

#2. คำสั่งเพิ่ม user นักเรียนเข้าสู่ระบบการ authen (ตาราง radcheck)
INSERT INTO radcheck
select '',username,'Password','==',password from account 

#3. คำสั่งจัดนักเรียนเข้ากลุ่ม  (โดยพิจารณาจากชื่อกลุ่มและระดับชั้น)
insert into usergroup
select username,'group20090607170420',1 from account
where username in (select id from students where level = 1 and year = 1)

group20090607170420  คือ กลุ่ม
students ชื่อตาราง
level = 1 ชื่อคอลัมภ์ช่วงชั้นที่ 1
year = 1 ชื่อคอลัมภ์ชั้นปีที่ 1

------------------------------------------------------------------------------------------------------------------------------------------------------------
#firewall.iptables

#!/bin/sh
#
# Firewall script for ChilliSpot
# A Wireless LAN Access Point Controller
#
# Uses $EXTIF (eth0) as the external interface (Internet or intranet) and
# $INTIF (eth1) as the internal interface (access points).
#
#
# SUMMARY
# * All connections originating from chilli are allowed.
# * Only ssh is allowed in on external interface.
# * Nothing is allowed in on internal interface.
# * Forwarding is allowed to and from the external interface, but disallowed
#   to and from the internal interface.
# * NAT is enabled on the external interface.

IPTABLES="/sbin/iptables"
EXTIF="eth0"
INTIF="eth1"

#Flush all rules
$IPTABLES -F
$IPTABLES -F -t nat
$IPTABLES -F -t mangle

#Set default behaviour
$IPTABLES -P INPUT DROP
$IPTABLES -P FORWARD ACCEPT
$IPTABLES -P OUTPUT ACCEPT

#Allow related and established on all interfaces (input)
$IPTABLES -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT

##### chalee edit
#Allow releated, established and ssh on $EXTIF. Reject everything else.
$IPTABLES -A INPUT -i $EXTIF -p tcp -m tcp --dport 22 --syn -j ACCEPT
$IPTABLES -A INPUT -i $EXTIF -p tcp -m tcp --dport 80 --syn -j ACCEPT
$IPTABLES -A INPUT -i $EXTIF -p tcp -m tcp --dport 53 --syn -j ACCEPT
$IPTABLES -A INPUT -i $EXTIF -p tcp -m tcp --dport 10000 --syn -j ACCEPT
$IPTABLES -A INPUT -i $EXTIF -p tcp -m tcp --dport 3306 --syn -j ACCEPT

#Allow related and established from $INTIF. Drop everything else.
$IPTABLES -A INPUT -i $INTIF -j DROP

#Allow http and https on other interfaces (input).
#This is only needed if authentication server is on same server as chilli
$IPTABLES -A INPUT -p tcp -m tcp --dport 80 --syn -j ACCEPT
$IPTABLES -A INPUT -p tcp -m tcp --dport 443 --syn -j ACCEPT

#Allow 3990 on other interfaces (input).
$IPTABLES -A INPUT -p tcp -m tcp --dport 3990 --syn -j ACCEPT
$IPTABLES -A INPUT -p tcp -m tcp --dport 3128 --syn -j ACCEPT
$IPTABLES -A INPUT -p tcp -m tcp --dport 3306 --syn -j ACCEPT
$IPTABLES -A INPUT -p tcp -m tcp --dport 22 --syn -j ACCEPT
$IPTABLES -A INPUT -p tcp -m tcp --dport 10000 --syn -j ACCEPT
$IPTABLES -A INPUT -p tcp -m tcp --dport 53 --syn -j ACCEPT

#Allow ICMP echo on other interfaces (input).
$IPTABLES -A INPUT -p icmp --icmp-type echo-request -j ACCEPT

##Allow transparent proxy (wiboon 1/2)
$IPTABLES -A INPUT -p tcp -m tcp --dport 3128 --syn -j ACCEPT

#Allow everything on loopback interface.
$IPTABLES -A INPUT -i lo -j ACCEPT

##Allow transparent proxy (wiboon 2/2)

$IPTABLES -t nat -A PREROUTING -i tun0 -p tcp -m tcp --dport 3128 --syn -j DROP
$IPTABLES -t nat -A PREROUTING -i tun0 -p tcp -m tcp -d 192.168.0.0/16 --dport 80 -j RETURN
$IPTABLES -t nat -A PREROUTING -i tun0 -p tcp -m tcp -d 172.16.0.0/12 --dport 80 -j RETURN
$IPTABLES -t nat -A PREROUTING -i tun0 -p tcp -m tcp -d 10.0.0.0/8 --dport 80 -j RETURN
$IPTABLES -t nat -A PREROUTING -i tun0 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 3128

# Drop everything to and from $INTIF (forward)
# This means that access points can only be managed from ChilliSpot
$IPTABLES -A FORWARD -i $INTIF -j DROP
$IPTABLES -A FORWARD -o $INTIF -j DROP

#Enable NAT on output device
$IPTABLES -t nat -A POSTROUTING -o $EXTIF -j MASQUERADE

------------------------------------------------------------------------------------------------------------------------------------------------------------------

 การ Clear Log ของ  Squid

rm -rf /var/log/squid/*    <------ คำสั่งเดียวจบครับ 
rm -rf /var/spool/squid/* <------ เคลียร์แคชครับ
/etc/init.d/squid restart   <------ Restart squid ใหม่

อาจตั้งค่าไว้ใน crontab ก็ได้ครับ เช่น 
00 01  * * 1   root   bash /root/ccache.sh     <------- เทียงคืนหนึ่งนาทีของทุกวันจันทร์ run script ccache.sh
00 40 23 * *   root  bash /root/clog.sh          <------ เที่ยงคืนสี่สิบนาทีของทุกวันที่ 23 run script clog.sh

ไฟล์ ccache.sh
#!/bin/sh 
###script clear cache
rm -rf /var/spool/squid/*
/etc/init.d/squid restart

ไฟล์ clog.sh
#!/bin/sh
###script clear log
rm -rf /var/log/squid/*
/etc/init.d/squid restart

นำ script ทั้ง 2 ไฟล์นี้ไปเก็บไว้ที่ /root นะครับ
อย่าลืม #chmod 755 /root/ccache.sh
         #chmod 755 /root/clog.sh

---------------------------------------------------------------------------------------------------------------------------------------

#Example sshd_config block user for sshd

# $OpenBSD: sshd_config,v 1.73 2005/12/06 22:38:28 reyk Exp $

# This is the sshd server system-wide configuration file.  See
# sshd_config(5) for more information.

# This sshd was compiled with PATH=/usr/local/bin:/bin:/usr/bin

# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented.  Uncommented options change a
# default value.

#Port 22
#Protocol 2,1
Protocol 2
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::

# HostKey for protocol version 1
#HostKey /etc/ssh/ssh_host_key
# HostKeys for protocol version 2
#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_dsa_key

# Lifetime and size of ephemeral version 1 server key
#KeyRegenerationInterval 1h
#ServerKeyBits 768

# Logging
# obsoletes QuietMode and FascistLogging
#SyslogFacility AUTH
SyslogFacility AUTHPRIV
#LogLevel INFO

# Authentication:

#LoginGraceTime 2m
#PermitRootLogin yes
#StrictModes yes
#MaxAuthTries 6

#RSAAuthentication yes
#PubkeyAuthentication yes
#AuthorizedKeysFile .ssh/authorized_keys

# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#RhostsRSAAuthentication no
# similar for protocol version 2
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# RhostsRSAAuthentication and HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes

# To disable tunneled clear text passwords, change to no here!
#PasswordAuthentication yes
#PermitEmptyPasswords no
PasswordAuthentication yes

# Change to no to disable s/key passwords
#ChallengeResponseAuthentication yes
ChallengeResponseAuthentication no

# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no

# GSSAPI options
#GSSAPIAuthentication no
GSSAPIAuthentication yes
#GSSAPICleanupCredentials yes
GSSAPICleanupCredentials yes

# Set this to 'yes' to enable PAM authentication, account processing, 
# and session processing. If this is enabled, PAM authentication will 
# be allowed through the ChallengeResponseAuthentication mechanism. 
# Depending on your PAM configuration, this may bypass the setting of 
# PasswordAuthentication, PermitEmptyPasswords, and 
# "PermitRootLogin without-password". If you just want the PAM account and 
# session checks to run without PAM authentication, then enable this but set 
# ChallengeResponseAuthentication=no
#UsePAM no
UsePAM yes

# Accept locale-related environment variables
AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES 
AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT 
AcceptEnv LC_IDENTIFICATION LC_ALL
#AllowTcpForwarding yes
#GatewayPorts no
#X11Forwarding no
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
#UsePrivilegeSeparation yes
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#ShowPatchLevel no
#UseDNS yes
#PidFile /var/run/sshd.pid
#MaxStartups 10
#PermitTunnel no

# no default banner path
#Banner /some/path

# override default of no subsystems
Subsystem sftp /usr/libexec/openssh/sftp-server
DenyUsers science

---------------------------------------------------------------------------------------------------------------------------------------

# Example /etc/vsftpd/vsftpd.conf

 # Example config file /etc/vsftpd/vsftpd.conf
#
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
#
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# capabilities.
#
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=YES
#
# Uncomment this to allow local users to log in.
local_enable=YES
#
# Uncomment this to enable any form of FTP write command.
write_enable=YES
#
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
local_umask=022
#
# Uncomment this to allow the anonymous FTP user to upload files. This only
# has an effect if the above global write enable is activated. Also, you will
# obviously need to create a directory writable by the FTP user.
#anon_upload_enable=YES
#
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
#anon_mkdir_write_enable=YES
#
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
dirmessage_enable=YES
#
# Activate logging of uploads/downloads.
xferlog_enable=YES
#
# Make sure PORT transfer connections originate from port 20 (ftp-data).
connect_from_port_20=YES
#
# If you want, you can arrange for uploaded anonymous files to be owned by
# a different user. Note! Using "root" for uploaded files is not
# recommended!
#chown_uploads=YES
#chown_username=whoever
#
# You may override where the log file goes if you like. The default is shown
# below.
#xferlog_file=/var/log/vsftpd.log
#
# If you want, you can have your log file in standard ftpd xferlog format
xferlog_std_format=YES
#
# You may change the default value for timing out an idle session.
#idle_session_timeout=600
#
# You may change the default value for timing out a data connection.
#data_connection_timeout=120
#
# It is recommended that you define on your system a unique user which the
# ftp server can use as a totally isolated and unprivileged user.
#nopriv_user=ftpsecure
#
# Enable this and the server will recognise asynchronous ABOR requests. Not
# recommended for security (the code is non-trivial). Not enabling it,
# however, may confuse older FTP clients.
#async_abor_enable=YES
#
# By default the server will pretend to allow ASCII mode but in fact ignore
# the request. Turn on the below options to have the server actually do ASCII
# mangling on files when in ASCII mode.
# Beware that on some FTP servers, ASCII support allows a denial of service
# attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd
# predicted this attack and has always been safe, reporting the size of the
# raw file.
# ASCII mangling is a horrible feature of the protocol.
#ascii_upload_enable=YES
#ascii_download_enable=YES
#
# You may fully customise the login banner string:
#ftpd_banner=Welcome to blah FTP service.
#
# You may specify a file of disallowed anonymous e-mail addresses. Apparently
# useful for combatting certain DoS attacks.
#deny_email_enable=YES
# (default follows)
#banned_email_file=/etc/vsftpd/banned_emails
#
# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
#chroot_list_enable=YES

chroot_local_user=yes

# (default follows)
#chroot_list_file=/etc/vsftpd/chroot_list
#
# You may activate the "-R" option to the builtin ls. This is disabled by
# default to avoid remote users being able to cause excessive I/O on large
# sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
# the presence of the "-R" option, so there is a strong case for enabling it.
#ls_recurse_enable=YES
#
# When "listen" directive is enabled, vsftpd runs in standalone mode and 
# listens on IPv4 sockets. This directive cannot be used in conjunction 
# with the listen_ipv6 directive.
listen=YES
#
# This directive enables listening on IPv6 sockets. To listen on IPv4 and IPv6
# sockets, you must run two copies of vsftpd whith two configuration files.
# Make sure, that one of the listen options is commented !!
#listen_ipv6=YES

pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES

---------------------------------------------------------------------------------------------------------------------------------------

#Share internet and transparent proxy with iptables

iptables -t nat -A POSTROUTING -d ! 192.168.1.0/24 -j MASQUERADE
iptables -A FORWARD -s 192.168.1.0/24 -j ACCEPT
iptables -A FORWARD -d 192.168.1.0/24 -j ACCEPT
iptables -A FORWARD -j DROP
iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 80 -j REDIRECT --to-port 8080
iptables-save > /etc/sysconfig/iptables
nano /etc/sysctl.conf 

---------------------------------------------------------------------------------------------------------------------------------------

DNS

# 1 # Example   named.conf

//
// named.conf for Red Hat caching-nameserver 
//

options {
 directory "/var/named";
 dump-file "/var/named/data/cache_dump.db";
 statistics-file "/var/named/data/named_stats.txt";
 /*
  * If there is a firewall between you and nameservers you want
  * to talk to, you might need to uncomment the query-source
  * directive below.  Previous versions of BIND always asked
  * questions using port 53, but BIND 8.1 uses an unprivileged
  * port by default.
  */
  // query-source address * port 53;
};

// 
// a caching only nameserver config
// 
controls {
 inet 127.0.0.1 allow { localhost; } keys { rndckey; };
};

zone "." IN {
 type hint;
 file "named.ca";
};

zone "localdomain" IN {
 type master;
 file "localdomain.zone";
 allow-update { none; };
};

zone "localhost" IN {
 type master;
 file "localhost.zone";
 allow-update { none; };
};

zone "0.0.127.in-addr.arpa" IN {
 type master;
 file "named.local";
 allow-update { none; };
};

zone "0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" IN {
 type master;
 file "named.ip6.local";
 allow-update { none; };
};

zone "255.in-addr.arpa" IN {
 type master;
 file "named.broadcast";
 allow-update { none; };
};

zone "0.in-addr.arpa" IN {
 type master;
 file "named.zero";
 allow-update { none; };
};

include "/etc/rndc.key";
zone "kk.ac.th" {
 type master;
 file "/var/named/kk.ac.th.hosts";
 };
zone "135.143.202.in-addr.arpa" {
 type master;
 file "/var/named/202.143.135.rev";
 };

# 2 #

#Edit Records File   /var/named/kk.ac.th.hosts

$ttl 38400
kk.ac.th. IN SOA ns1.kk.ac.th. root.kk.ac.th. (
   1220787991
   10800
   3600
   604800
   38400 )
kk.ac.th. IN NS ns1.kk.ac.th.
ns1.kk.ac.th. IN A 202.143.135.34
ns2.kk.ac.th. IN A 202.143.135.35
ns3.kk.ac.th. IN A 202.143.135.36
ns4.kk.ac.th. IN A 202.143.135.37
www.kk.ac.th. IN CNAME ns1.kk.ac.th.
home.kk.ac.th. IN CNAME ns2.kk.ac.th.
grade.kk.ac.th. IN CNAME ns3.kk.ac.th.
log.kk.ac.th. IN CNAME ns4.kk.ac.th.
kk.ac.th. IN MX 1 ASPMX.L.GOOGLE.COM.
kk.ac.th. IN MX 5 ALT1.ASPMX.L.GOOGLE.COM.
kk.ac.th. IN MX 5 ALT2.ASPMX.L.GOOGLE.COM.
kk.ac.th. IN MX 10 ASPMX2.GOOGLEMAIL.COM.
kk.ac.th. IN MX 10 ASPMX3.GOOGLEMAIL.COM.
kk.ac.th. IN MX 10 ASPMX4.GOOGLEMAIL.COM.
kk.ac.th. IN MX 10 ASPMX5.GOOGLEMAIL.COM.

# 3 # Edit Master Zone   202.143.135

# Edit Records File  /var/named/202.143.135.rev

$ttl 38400
135.143.202.in-addr.arpa. IN SOA ns1.kk.ac.th. root.kk.ac.th. (
   1220787989
   10800
   3600
   604800
   38400 )
135.143.202.in-addr.arpa. IN NS ns1.kk.ac.th.
34.135.143.202.in-addr.arpa. IN PTR ns1.kk.ac.th.
35.135.143.202.in-addr.arpa. IN PTR ns2.kk.ac.th.
36.135.143.202.in-addr.arpa. IN PTR ns3.kk.ac.th.
37.135.143.202.in-addr.arpa. IN PTR ns4.kk.ac.th.

------------------------------------------------------------------------------------------------------------------------------------------------------------------

DHCP SERVER  3 NIC

#Example   dhcpd.conf 

ddns-update-style ad-hoc;
subnet 10.10.0.0 netmask 255.255.254.0 {
 option domain-name-servers 202.143.135.34, 203.146.15.9, 203.146.0.30, 203.144.255.71, 203.144.255.72;
 option domain-name "ns1.kk.ac.th";
 option broadcast-address 10.10.1.255;
 option subnet-mask 255.255.254.0;
 option routers 10.10.0.1;
 range 10.10.0.2 10.10.1.254;
 }
ddns-update-style ad-hoc;
subnet 192.168.11.0 netmask 255.255.255.0 {
 option domain-name-servers 202.143.135.34, 203.146.15.9, 203.146.0.30, 203.144.255.71, 203.144.255.72;
 option domain-name "ns1.kk.ac.th";
 option broadcast-address 192.168.11.255;
 option subnet-mask 255.255.255.0;
 option routers 192.168.11.1;
 range 192.168.11.10 192.168.11.210;
 }
ddns-update-style ad-hoc;
subnet 192.168.12.0 netmask 255.255.255.0 {
 option domain-name-servers 202.143.135.34, 203.146.15.9, 203.146.0.30, 203.144.255.71, 203.144.255.72;
 option domain-name "ns1.kk.ac.th";
 option broadcast-address 192.168.12.255;
 option subnet-mask 255.255.255.0;
 option routers 192.168.12.1;
 range 192.168.12.10 192.168.12.210;
 }

------------------------------------------------------------------------------------------------------------------------------------------------------------------

BLOCK QQ

โรงเรียนผมใช้ linuxsis 5.0 นักเรียนชอบแซต โดยใช้ qq ทำให้ระบบมันช้ามาก ยิ่งการแชร์อินเตอร์เนทผ่านดาวเทียมไอพีสตาร์ความเร็วไม่มาก จึงทดลองหลายวิธีทั้งสืบ ทั้ง ค้น และทดลองใช้ ก็ปรากฏว่า มีตัวที่สามารถจัดการได้โดยใช้ iptables ครับ 

ล็อกอินด้วย root พิมพ์ pico /etc/sysconfig/iptables 

# Generated by iptables-save v1.3.0 on Tue Aug 29 08:54:47 2006 *nat :OUTPUT ACCEPT [65:4034] :POSTROUTING ACCEPT [36:2205] :PREROUTING ACCEPT [109:9593] 

-A POSTROUTING -o eth1 -j MASQUERADE 

-A PREROUTING -i eth0 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080 COMMIT 

# Completed on Tue Aug 29 08:54:47 2006 

# Generated by iptables-save v1.3.0 on Tue Aug 29 08:54:47 2006 *filter :FORWARD ACCEPT [0:0] :INPUT ACCEPT [0:0] :OUTPUT ACCEPT [1105:210779] 

:SIS5-Firewall - [0:0] 

-A FORWARD -s 203.195.110.243 -p tcp -j DROP เพิ่มตรงนี้ละครับ 

ข้างล่างปล่อยไว้เหมือนเดิม บันทึก แล้วสั่งให้ รับค่าใหม่โดยใช้คำสั่ง service iptables restart ลองดูนะครับ 

------------------------------------------------------------------------------------------------------------------------------------------------------------------

#Basic Squid.conf

http_port 8080 transparent
http_port 8080
icp_port 3130
hierarchy_stoplist cgi-bin ?
acl porn url_regex -i www.sex.com
http_access deny porn
#Block-BIT
#
acl bit url_regex -i .*announce passkey
#http_access deny bit
acl QUERY urlpath_regex cgi-bin \?
no_cache deny QUERY
cache_mem 680 MB
cache_replacement_policy heap GDSF
memory_replacement_policy heap GDSF
cache_dir ufs /cache/squid 4000 16 128
cache_store_log none
acl lan src 192.168.4.0/255.255.255.0
acl localhost src 127.0.0.1/255.255.255.255
acl Safe_ports port 80 443 210 70 21 1025-65535
acl CONNECT method CONNECT
acl all src 0.0.0.0/0.0.0.0
visible_hostname none
http_access allow lan
http_access allow localhost
http_access deny !Safe_ports
http_access deny CONNECT
http_access deny all
cache_mgr Please Contact Mr.Yothin Ngamsakul Tel.                087-8787135         (AIS)
cache_effective_user squid
cache_effective_group squid
logfile_rotate 0
log_icp_queries off
cachemgr_passwd my-secret-pass all
buffered_logs on
#Transparent Proxy 
#httpd_accel_host virtual
#httpd_accel_port 80
#httpd_accel_with_proxy on
#httpd_accel_uses_host_header on

------------------------------------------------------------------------------------------------------------------------------------------------------------------

ลืมม .. Password Root ของ MySQL ทำไงดี30 มิ.ย. 08 | โดย : BLOG in TREND | ป้าย : MySQL , passowrd , reset , rootห่างหายจาก ChilliSpot ไปหลายวันกลับมา ไม่สามารถเข้า MySQL ได้เพราะว่า ลืม Password ของ Root จะลงใหม่ก็ไม่ได้ ทำไงดี .. เลยอาศัย พี่ Google เหมือนเดิมสรุปว่า ทำได้ง่ายมาก ๆ เลย note ไว้ให้เพื่อน ๆ ลองทำดูเฝื่อจะ หลงลืม แบบผมนะครับ
บางครั้งเครื่องที่ตัวเองดูแลมีเยอะมาก จนนานๆ ทีถึงจะเข้ามา manage ซักที และบางครั้งถึงกับให้ลืม password ตัวนั้นตัวนี้จนได้ และลืมมาก จนบางทีลืม password root ของ mysql ไปเลย 
เรามาดูวิธี reset root password ของ mysql กัน ทำดังนี้ 
1.เ พิ่ม "skip-grant-tables" ลงใน file my.cnf โดยปกติทั่วไปจะเก็บอยู่ที่ /etc/my.cnf โดยเพิ่มในส่วนของ [mysqld] สำคัญมากห้ามลืม อย่าใส่ผิดที่ ไม่ัอย่างนั้นจะไม่สามารถ reset password ได้ 
2.สั่ง restart mysql service ซะ ในที่นี้ ผมใช้ RH base เป็นหลัก ใครใช้อย่างไหน ก็ restart อย่างนั้นล่ะ 
ถ้าเป็น RH สั่งแบบนี้ # /etc/init.d/mysqld restart หรือแบบนี้ # service mysql restart3.ตั้งค่า mysql root password ใหม่ซะ จะสั่งแบบไหนก็ได้ จะเข้า console หรือสั่งผ่าน command line ก็ตามสะดวก 
mysql -uroot -p 
Enter password: <<<< ใส่ pass ที่เพิ่ง reset ซะ 
Welcome to the MySQL monitor.  Commands end with ; or \g. 
Your MySQL connection id is 151906 to server version: 4.1.10a 
Type 'help;' or '\h' for help. Type '\c' to clear the buffer. 

mysql> 
ถ้าเข้าได้แบบด้านบน แสดงว่าเรียบร้อย .
    4. นำ skip-grant-tables ออกจาก file my.cnf ซะ
    5. restart mysql service เป็นอันเสร็จ 

อีกวิธี
# /etc/init.d/mysql stop 

สั่งสตาร์ท ในโหมดไม่ใช้เทเบิล 
# mysqld_safe --skip-grant-tables & 

ตรงนี้รอสักพัก  มันจะเหมือนค้าง  รอสักพักกด enter  มันจะคืนพร้อมมาให้ 
เข้าแแบบไม่มีพาสเวิร์ด 

#mysql -u root  
  mysql> use mysql; 
  mysql> update user set password=PASSWORD("พาสเวิร์ดใหม่") where User='root'; 
  mysql> flush privileges; 
  mysql> quit 

restart service สักรอบ 
# /etc/init.d/mysqld stop 
# /etc/init.d/mysqld start

-------------------

เรามาดูวิธี reset root password ของ mysql กัน ทำดังนี้ 
เ พิ่ม "skip-grant-tables" ลงใน file my.cnf โดยปกติทั่วไปจะเก็บอยู่ที่ /etc/my.cnf โดยเพิ่มในส่วนของ [mysqld] สำคัญมากห้ามลืม อย่าใส่ผิดที่ ไม่ัอย่างนั้นจะไม่สามารถ reset password ได้ 
สั่ง restart mysql service ซะ ในที่นี้ ผมใช้ RH base เป็นหลัก ใครใช้อย่างไหน ก็ restart อย่างนั้นล่ะ
ถ้าเป็น RH สั่งแบบนี้ 

อ้างอิง:
# /etc/init.d/mysqld restart  

หรือแบบนี้ 

อ้างอิง:
# service mysql restart  

ตั้งค่า mysql root password ใหม่ซะ จะสั่งแบบไหนก็ได้ จะเข้า console หรือสั่งผ่าน command line ก็ตามสะดวก 
นำ skip-grant-tables ออกจาก file my.cnf ซะ 
restart mysql service เป็นอันเสร็จ 
จากนั้นให้ลองเข้า mysql ดู ลองสั่งดังนี้

อ้างอิง:
mysql -uroot -p
Enter password: <<<< ใส่ pass ที่เพิ่ง reset ซะ
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 151906 to server version: 4.1.10a

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>  

ถ้าเข้าได้แบบด้านบน แสดงว่าเรียบร้อย .
เรียบร้อยคิคิ 

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

#Setuser

#!/bin/bash
echo Username
read un
#echo Realname
#read cm
finger $un
echo ===============================
read sure
RESULT="Error - Try other username again .. "
EXIST=0
id $un >/dev/null 2>/dev/null && EXIST=1
if [ $EXIST = 0 ]; then
groupadd $un
useradd -g $un -d /home/$un $un
chmod 755 /home/$un
mkdir /home/$un/public_html
chown  -R $un:$un /home/$un
usermod -d /home/$un $un
passwd $un
RESULT="Complete"
fi
echo "Add new user : $RESULT"
ln -sf /home/$un/public_html /var/www/html/$un

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Fedora: การจัดการโควต้าพื้นที่ดิสก์ของผู้
โดย...วิภัทร ศรุติพรหม wipat.s@psu.ac.th

1. ตรวจสอบดูว่ามีการติดตั้งโปรแกรมโควต้าดิสค์แล้ว ด้วยคำสั่ง rpm -qa | grep quota
ได้ผลดังตัวอย่าง quota-3.06-11

2. แก้ไขแฟ้ม /etc/fstab ในส่วนของ disk partition ที่ต้องการควบคุมโควต้าจากเดิม
LABEL=/     /          ext3    defaults        1 1 

ให้เป็น
LABEL=/     /          ext3    defaults,usrquota        1 1

  3.สร้างแฟ้มสำหรับเก็บข้อมูลโควต้า ด้วยคำสั่งดังนี้
touch /aquota.user
chmod 600 /aquota.user4. รีบูทเครื่องใหม่แล้วใช้คำสั่งต่อไปคือ

/sbin/quotaoff -a   หมายเหตุ *** อาจมี error ขึ้นว่า quotaoff: Can not find quota file on ...... 
เนื่องจากว่ายังไม่เคยมีระบบดิสก์โควต้า ไม่ถือว่าผิดปรกติ ให้ทำขั้นตอนต่อไปได้เลยคือ

/sbin/quotacheck -vgum -a
/sbin/quotaon -a 

5. ทดสอบดูผลด้วยคำสั่ง /usr/sbin/repquota -a ได้ผลดังตัวอย่าง
*** Report for user quotas on device /dev/hda2
Block grace time: 7days; Inode grace time: 7days
                        Block limits                File limits
User            used    soft    hard  grace    used  soft  hard  grace
----------------------------------------------------------------------
root      -- 2573608       0       0         150844     0     0
daemon  --       8       0       0              3     0     0
lp        --      12       0       0              3     0     0

6. กำหนดค่าโควต้าดิสก์ของผู้ใช้แต่ละคนด้วยคำสั่ง/usr/sbin/setquota
ตัวอย่างเช่นต้องการจำกัดผู้ใช้ชื่อ myuser
มีพื้นที่ไม่เกิน 200000 blocks(200 Mbytes) และ/หรือ 1000 inodes(แฟ้ม)
โดยเริ่มเตือนที่ 160000 blocks(160 Mbytes) และ/หรือ 800 inodes ด้วยตัวอย่างคำสั่ง

/usr/sbin/setquota -u myuser 160000 200000 800 1000 -a

7. ตรวจสอบข้อมูลโควต้าของผู้ใช้ชื่อ myuser ด้วยตัวอย่างคำสั่ง  quota -v myuser
Disk quotas for user myuser (uid 14533):
     Filesystem  blocks   quota     limit   grace   files   quota   limit   grace
     /dev/hda2       4  160000  200000             1     800  1000

ความหมายของค่าต่างๆตามคอลัมน์คือ
blocks=ขนาดพื้นที่ดิสก์ที่ใช้ไป, quota=ขนาดดิสก์ที่เริ่มเตือน, limit=ขนาดดิสก์ที่จำกัด
files=จำนวนแฟ้มที่ใช้ไป, quota=จำนวนแฟ้มที่เริ่มเตือน, limit=จำนวนแฟ้มที่จำกัด

8.เนื่องจากระบบไม่ได้ตรวจสอบโควต้าตลอดเวลาทุกครั้งที่มีผู้ใช้งานแฟ้มข้อมูล
จึงต้องตั้งค่าให้มีการตรวจสอบทุกวันโดยสร้างแฟ้มข้อมูลชื่อ
/etc/cron.daily/quota-check.cron มีข้อมูลดังนี้
#!/bin/sh
/sbin/quotaoff -a
/sbin/quotacheck -vagum -a
/sbin/quotaon -a

และตั้งค่าให้มีการตรวจสอบโควต้าดิสก์ทุกครั้งที่บูทเครื่อง
โดยใส่เพิ่มข้อความคำสั่งเข้าไปไว้ในแฟ้ม /etc/rc.local ดังนี้
sh /etc/cron.daily/quota-check.cron

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

ยกเลิกแล้ว--การจัดการโควต้าพื้นที่ดิสก์ของผู้ใช้ (20-2-2551)      
User Rating: / 11 
แย่ดีที่สุด  Contributed by วิภัทร -     
จันทร์, 31 มกราคม 2005  
บันทึกนี้ยกเลิกแล้ว โปรดใช้บันทึกใหม่ได้ที่ http://opensource.cc.psu.ac.th/Ubuntu

--วิภัทร

disk quota setup Made-EASY
วิภัทร ศรุติพรหม wipat.s@psu.ac.th

ประวัติการปรับปรุง
ครั้งที่ 1.3    20-2-2551   โดย: วิภัทร

เป็นคำแนะนำติดตั้งระบบจัดการโควต้าดิสค์ของผู้ใช้ลินุกซ์
ต้นฉบับทดสอบด้วย linux ubuntu ใช้งานภายในมหาวิทยาลัยสงขลานครินทร์

1.หากเป็น ubuntu ให้ติดตั้งโปรแกรมโควต้าดิสค์ด้วยคำั่สั่ง apt-get install quota

2.แก้ไขแฟ้ม /etc/fstab ในส่วนของ disk partition ที่ต้องการควบคุมโควต้าจากเดิม
3.# <file system> <mount point>   <type>  <options>       <dump>  <pass>
/dev/hda1       /               ext3    defaults,errors=remount-ro 0       1

ให้เป็น
/dev/hda1       /               ext3    defaults,usrquota,errors=remount-ro 0       1

4.สร้างแฟ้มสำหรับเก็บข้อมูลโควต้า ด้วยคำสั่งดังนี้
touch /aquota.user
chmod 600 /aquota.user

5.รีบูทเครื่องใหม่แล้วใช้คำสั่งต่อไปคือ
/sbin/quotaoff -a
   หมายเหตุ *** อาจมี error ขึ้นว่า quotaoff: Can not find quota file on ...... 
เนื่องจากว่ายังไม่เคยมีระบบดิสก์โควต้า ไม่ถือว่าผิดปรกติ ให้ทำขั้นตอนต่อไปได้เลยคือ
/sbin/quotacheck -vgum -a
/sbin/quotaon -a 

6.ทดสอบดูผลด้วยคำสั่ง /usr/sbin/repquota -a ได้ผลดังตัวอย่าง
*** Report for user quotas on device /dev/hda2
Block grace time: 7days; Inode grace time: 7days
                        Block limits                File limits
User            used    soft    hard  grace    used  soft  hard  grace
----------------------------------------------------------------------
root      -- 2573608       0       0         150844     0     0
daemon  --       8       0       0              3     0     0
lp        --      12       0       0              3     0     0

7.กำหนดค่าโควต้าดิสก์ของผู้ใช้แต่ละคนด้วยคำสั่ง/usr/sbin/setquota
ตัวอย่างเช่นต้องการจำกัดผู้ใช้ชื่อ myuser
มีพื้นที่ไม่เกิน 200000 blocks(200 Mbytes) และ/หรือ 1000 inodes(แฟ้ม)
โดยเริ่มเตือนที่ 160000 blocks(160 Mbytes) และ/หรือ 800 inodes ด้้วยตัวอย่างคำสั่ง

/usr/sbin/setquota -u myuser 160000 200000 800 1000 -a

8.ตรวจสอบข้อมูลโควต้าของผู้ใช้ชื่อ myuser ด้วยตัวอย่างคำสั่ง  quota -v myuser
Disk quotas for user myuser (uid 14533):
     Filesystem  blocks   quota     limit   grace   files   quota   limit   grace
     /dev/hda2       4  160000  200000             1     800  1000
ความหมายของค่าต่างๆตามคอลัมน์คือ
blocks=ขนาดพื้นที่ดิสก์ที่ใช้ไป, quota=ขนาดดิสก์ที่เริ่มเตือน, limit=ขนาดดิสก์ที่จำกัด
files=จำนวนแฟ้มที่ใช้ไป, quota=จำนวนแฟ้มที่เริ่มเตือน, limit=จำนวนแฟ้มที่จำกัด

9.เนื่องจากระบบไม่ได้ตรวจสอบโควต้าตลอดเวลาทุกครั้งที่มีผู้ใช้งานแฟ้มข้อมูล
จึงต้องตั้งค่าให้มีการตรวจสอบทุกวันโดยสร้างแฟ้มข้อมูลชื่อ
/etc/cron.daily/quota-check มีข้อมูลดังนี้
#!/bin/sh
/sbin/quotaoff -a
/sbin/quotacheck -vagum -a
/sbin/quotaon -a

และตั้งค่าให้มีการตรวจสอบโควต้าดิสก์ทุกครั้งที่บูทเครื่อง
โดยใส่เพิ่มข้อความคำสั่งเข้าไปไว้ในแฟ้ม /etc/rc.local ดังนี้
sh /etc/cron.daily/quota-check.cron 

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

ยกเลิกแล้ว--การติดตั้ง ftp server ด้วยโปรแกรม Vsftpd (13-11-2550)      
User Rating: / 35 
แย่ดีที่สุด  Contributed by วิภัทร -     
จันทร์, 31 มกราคม 2005  
***บันทึกนี้ยกเลิกแล้ว โปรดอ่านบันทึกใหม่ได้ที่  http://opensource.cc.psu.ac.th/Ubuntu

--วิภัทร

Vsftpd ftp server Made-EASY
วิภัทร ศรุติพรหม wipat.s@psu.ac.th

เวบไซต์ที่เกี่ยวข้อง http://rd.cc.psu.ac.th , http://opensource.psu.ac.th
และ http://share.psu.ac.th/planet/tank-it
คำถามต่างๆ โปรดใช้กระดานความรู้้ที่
http://opensource.psu.ac.th/index.php?option=com_simpleboard&Itemid=40

ประวัติการปรับปรุง
ครั้งที่ 2.1   13-11-2550   โดย: วิภัทร

เป็นคำแนะนำติดตั้งจัดการปรับแต่ง ftp server
ต้นแบบทดสอบด้วย linux ubuntu 6.06, fedora core 5,4 ใช้งานภายในมหาวิทยาลัยสงขลานครินทร์

วิธีติดตั้ง ftp server ด้วยโปรแกรม vsftpd

1.ติดตั้งโปรแกรม vsftpd 
หากเป็น ubuntu ให้ติดตั้งด้วยคำสั่ง
apt-get install vsftpd

หากเป็น fedora ให้ติดตั้งด้วยคำสั่ง
yum install vsftpd

2.หากเป็น fedora แก้ไขให้ทำงานทุกครั้งที่บูทเครื่อง
chkconfig vsftpd on 

3.สั่งให้ทำงานด้วยคำสั่งว่า
/etc/init.d/vsftpd start

4.ตรวจสอบว่า vsftpd ทำงานแล้วด้วยคำสั่ง
ps ax | grep vsftpd
ได้คำตอบประมาณว่า
..... ?        Ss     0:00 /usr/sbin/vsftpd ....
แสดงว่าใช้งานได้แล้ว

5.การให้แฟ้มข้อมูลสามารถเปิดอ่านได้ผู้ใช้แบบสาธารณะชื่อ anonymous
หากเป็น unbuntu ให้เก็บข้อมูลไว้ภายใต้ Directory ชื่อ /home/ftp/pub
ซึ่งต้องสร้าง directory เพิ่มคือ
mkdir -p /home/ftp/pub

หากเป็น fedora ให้เก็บข้อมูลไว้ภายใต้ Directory ชื่อ /var/ftp/pub ได้เลย

6.การปรับแต่งระบบทำได้โดยการแก้ไขแฟ้ม /etc/vsftpd/vsftpd.conf แล้ว ให้ระบบอ่านค่าที่ปรับใหม่ได้ด้วยคำสั่ง
/etc/init.d/vsftpd restart

7.การปรับแต่งค่าต่างๆ
หากเป็น ubuntu ให้แก้ไขแฟ้ม /etc/vsftpd.conf

หากเป็น fedora ให้แก้ไขแฟ้ม /etc/vsftpd/vsftpd.conf

ต้องการให้ใช้งานได้เฉพาะภายใน home ของตนเอง ไม่ต้องการให้ออกไปเพ่นพ่านที่อื่น
เพิ่ม/แก้ไขบรรทัดข้อความว่า chroot_local_user=YES

ต้องการห้าม anonymous เข้ามาใช้บริการ
เพิ่ม/แก้ไขบรรทัดข้อความว่า anonymous_enable=NO

ต้องการให้ user สามารถ upload แฟ้มได้
เพิ่ม/แก้ไขบรรทัดข้อความว่า local_enable=YES และ write_enable=YES

แก้ไขเสร็จแล้วสั่ง vsftpd ทำงานใหม่ด้วยคำสั่ง
/etc/init.d/vsftpd reload

8.บน fedora หากเจอปัญหา upload แฟ้มขึ้น ftp server นี้ไม่ได้
อาจเกิดจาก selinux ให้สั่งปิดการทำงานของ selinux 
โดยแก้ไขแฟ้มชื่อ /etc/selinux/config
แก้ไขบรรทัดข้อความจากเดิมคือ SELINUX=enforcing
ให้เป็นข้อความว่า SELINUX=disabled
ต้อง reboot ใหม่แล้ว selinux จึงจะปิดการทำงานตามต้องการ

9.ตัวอย่างหากต้องการเพิ่ม hard disk ลูกใหม่เข้าไป และต้องการให้ไปเป็นส่วนหนึ่งของพื้นที่ใน /home/ftp/pub
ให้จัดการติดตั้ง hard disk และ mount ให้เรียบร้อยสามารถใช้งานได้ซะก่อน
ตัวอย่างของผมคือเพิ่ม hard disk /dev/hdb1 ไปในพื้นที่ /mnt/data
และต้องการให้ไปโผล่เป็นส่่วนหนึ่งของ /home/ftp/pub/newdisk
ทำคำสั่งขั้นตอนดังนี้คือ
mkdir  -p  /mnt/data
mount  /dev/hdb1  /mnt/data
mkdir  -p  /home/ftp/pub/newdisk
mount  --bind  /mnt/data  /home/ftp/pub/newdisk

แค่นี้ก็เสร็จแล้ว ตรวจสอบดูผลงานได้เลย

แก้ไขให้ระบบทำงานคำสั่งเหล่านี้โดยอัตโนมัติทุกครั้งที่บูทเครื่อง
ต้องแก้ไขแฟ้ม /etc/rc.local โดยเพิ่มบรรทัดคำสั่งเหล่านั้นเข้าไปด้วย

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 

การติดตั้ง mail + imap/pop3 server ด้วยโปรแกรม Sendmail + Dovecot (14-12-2549)      

User Rating: / 8 
แย่ดีที่สุด 
Contributed by วิภัทร -     
พฤหัสบดี, 14 ธันวาคม 2006  

Sendmail mail server Made-EASY
วิภัทร ศรุติพรหม wipat.s@psu.ac.th

เวบไซต์ที่เกี่ยวข้อง http://rd.cc.psu.ac.th และ http://opensource.psu.ac.th
คำถามต่างๆ โปรดใช้กระดานความรู้ที่ 
http://rd.cc.psu.ac.th/component/option,com_mamboboard/Itemid,55/

ประวัติการปรับปรุง
ครั้งที่ 1.0  14-12-2549   โดย: วิภัทร

เป็นคำแนะนำติดตั้งโปรแกรม sendmail เพื่อทำเป็น mail server
ต้นแบบทดสอบด้วย linux fedora core 6,5,4 ใช้งานภายในมหาวิทยาลัยสงขลานครินทร์

1.หลังการติดตั้ง linux fedora core ระบบจะมีการติดตั้งโปรแกรม sendmail มาแล้วโดยอัตโนมัติอยู่แล้ว แต่ยังอาจขาดเครื่องมือบางตัว ให้ติดตั้งเพิ่มเติมอีกด้วยคำสั่ง

yum install sendmail sendmail-cf

ตรวจสอบดูว่าโปรแกรม sendmail ทำงานแล้วด้วยคำสั่ง
service  sendmail  status
จะได้ผลประมาณตัวอย่างว่า
sendmail (pid 1971 1963) is running...

2.ให้ทดสอบการส่งอีเมล์ให้ root ด้วยตัวอย่างคำสั่ง
echo "TEST-LOCAL" | sendmail  root
เป็นการส่งอีเมล์ให้แก่ root ของ server นี้
ตรวจสอบว่ามีอีเมล์เข้าไปถูกต้องในแฟ้ม /var/spool/mail

3.ให้ทดสอบส่งอีเมล์ให้แก่ผู้ใช้ที่อยู่นอก server ตัวนี้ ด้วยตัวอย่างคำสั่ง
echo "TEST-OUTSIDE" | sendmail  youremail@your.domain
เป็นการส่งอีเมล์ให้แก่ผู้รับปลายทางคือ youremail@your.domain 
ตรวจสอบดูว่ามีอีเมล์ไปถึงผู้รับปลายทางแล้ว

4.ใน ม.สงขลานครินทร์ มีการกำหนดไม่ให้เครื่องคอมพิวเตอร์ส่งอีเมล์ออกได้โดยตรง ต้องส่งผ่าน smtp.psu.ac.th เท่านั้น ให้ปรับแต่งดังนี้

แก้ไขแฟ้ม /etc/mail/sendmail.mc
ที่บรรทัดข้อความเดิมว่า
dnl define(`SMART_HOST',`smtp.your.provider')dnl
ให้แก้ไขเป็นว่า
define(`SMART_HOST',`smtp.psu.ac.th')dnl

แก้ไขเสร็จแล้วใช้คำสั่งว่า
m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
สั่งให้ sedmail ทำงานใหม่ด้วยคำสั่ง
service sendmail reload

ทำเพียงแค่นี้ ตรวจสอบผลงานได้เลย

5.หากต้องการให้สามารถรับอีเมล์จากโลกภายนอกได้
จำเป็นต้องมีชื่อ host ที่มีชื่อขึ้นทะเบียนใน DNS แล้วเท่านั้น
ไม่สามารถใช้เลข ip ของ server  ได้โดยตรง

ตัวอย่างสมมติว่าได้ชื่อ host ว่า my.host.domain
ให้แก้ไขแฟ้ม /etc/mail/sendmail.mc  ที่บรรทัดข้อความเดิมว่า
DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl

ให้ยกเลิกบรรทัดนี้ ด้วยการเติมข้อความว่า dnl นำหน้า ดังตัวอย่างเป็น
dnl DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl

แก้ไขเสร็จแล้วใช้คำสั่งว่า
m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
สั่งให้ sedmail ทำงานใหม่ด้วยคำสั่ง
service sendmail reload

ทดสอบผลงานส่งอีเมล์เข้าผู้ใช้ใน server ตัวนี้ได้เลย

6.หากต้องการให้โปรแกรมอีเมล์สามารถเข้ามาอ่านอีเมล์จาก server ตัวนี้ได้
ต้องติดตั้ง imap หรือ pop3 server เพิ่มเติม
ในเอกสารนี้ขอเลือกใช้โปรแกรม dovecot โดยทำดังนี้
ติดตั้งด้วยคำสั่ง  yum install dovecot

สั่งให้ทำงานทุกครั้งที่บูทเครื่องด้วยคำสั่ง chkconfig dovecot on

แก้ไขแฟ้ม /etc/dovecot.conf
ที่บรรทัดเดิมว่า #protocols = imap imaps pop3 pop3s
ให้ลบเครื่องหมาย # ออก เหลือเพียงว่า
protocols = imap imaps pop3 pop3s

สั่งให้โปรแกรม dovecot ทำงานด้วยคำสั่ง
service dovecot start

ทดสอบผลงาน imap server ด้วยคำสั่ง
telnet localhost 143
ถ้าได้ประมาณว่า 
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
+OK Dovecot ready.
แสดงว่าถูกต้อง ใช้งานได้ ให้กลับออกมาด้วยการกดแป้น CTRL_]
เมื่อได้ prompt ว่า telnet>  แล้วให้ป้อนคำว่า quit  ตามด้วย Enter  

ต่อไปลองทดสอบผลงาน pop3 server ด้วยคำสั่ง
telnet localhost 110 
ก็จะได้ผลทำนองเดียวกัน

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

ยกเลิกแล้ว--การติดตั้ง dns server ด้วยโปรแกรม bind (23-11-50)      
User Rating: / 34 
แย่ดีที่สุด  Contributed by วิภัทร -     
อาทิตย์, 26 มิถุนายน 2005  
บันทึกนี้ยกเลิกแล้ว โปรดใช้บันทึกใหม่ได้ที่ http://opensource.cc.psu.ac.th/Ubuntu

--วิภัทร

DNS server Made-EASY
วิภัทร ศรุติพรหม wipat.s@psu.ac.th

เวบไซต์ที่เกี่ยวข้อง http://rd.cc.psu.ac.th , http://share.psu.ac.th/planet/tank-it และ http://opensource.psu.ac.th
คำถามต่างๆ โปรดใช้กระดานความรู้ที่ 
http://rd.cc.psu.ac.th/component/option,com_mamboboard/Itemid,55/

ประวัติการปรับปรุง
ครั้งที่ 2.0    23-11-2550   โดย: วิภัทร

เป็นคำแนะนำติดตั้งจัดการ DNS server  ด้วยโปรแกรม bind 
ต้นแบบทดสอบด้วย linux ubuntu 6.06, fedora core 4 ใช้งานภายในมหาวิทยาลัยสงขลานครินทร์

1.สมมติว่า name server ของ ISP ที่ให้บริการ มีหมายเลข ip คือ 10.0.0.5  และ name server ของเราเป็นเลข 10.0.1.3

ก่อนติดตั้ง ให้ทดสอบว่า server เครื่องนี้ สามารถท่องอินเทอร์เนตได้อย่างสมบูรณ์

?ลองใช้ browser ไปที่ www.google.com ว่าใช้งานได้

?ตรวจสอบดู dns server ที่ตนเองใช้อยู่ในปัจจุบันในแฟ้ม /etc/resolv.conf ด้วยคำสั่งว่า  cat /etc/resolv.conf 
ได้ข้อความประมาณว่า

nameserver 10.0.0.5

ตัวอย่างนี้คือระบบเลือกใช้ name server มีหมายเลข ip คือ 10.0.0.5 

?ลองใช้คำสั่งว่า nslookup www.yahoo.com

Server:         10.0.0.5
Address:        10.0.0.5#53

Non-authoritative answer:
www.yahoo.com   canonical name = www.yahoo.akadns.net.
Name:   www.yahoo.akadns.net
Address: 209.191.93.52

2.โปรแกรม bind ที่ติดตั้งบน linux fedora core 4 จะเป็น name server แบบ caching only คือเป็น name server ที่ไม่ต้องมีการส่งข้อมูลออกไปให้ name server อื่นๆ ทำหน้าที่ไปค้นหา ip จาก name server แต่เพียงอย่างเดียว

ติดตั้งโปรแกรม bind 
หากเป็น ubuntu ใช้คำสั่ง
apt-get install bind9 bind9-doc
สั่งให้ DNS sever ทำงาน ใช้คำสั่ง
/etc/init.d/bind9 start
ปรับแต่งค่าต่างๆได้ที่แฟ้ม /etc/bind/named.conf.options
แล้วสั่งให้ DNS server ทำงานใหม่ด้วยคำสั่ง 
/etc/init.d/bind9 reload

หากเป็น fedora ใช้คำสั่ง
yum  install  bind  bind-utils  bind-chroot
ตั้งให้ทำงานทุกครั้งที่บูทเครื่อง ด้วยคำสั่ง
chkconfig named on
สั่งให้ DNS sever ทำงานใช้คำสั่ง
/etc/init.d/named start
ปรับแต่งค่าได้ที่แฟ้ม /var/named/chroot/etc/named.conf 
แล้วต้องสั่งให้ reload ใหม่ด้วยคำสั่ง
/etc/init.d/named reload

3.การทำเป็น name server แบบ forward only 
หากเป็น ubuntu ให้แก้ไขแฟ้ม /etc/bind/named.conf.options
หากเป็น fedora ให้แก้ไขแฟ้ม /var/named/chroot/etc/named.conf ให้มีข้อมูลประมาณดังตัวอย่าง

options {
        directory "/var/cache/bind";
### หากเป็น ubuntu ใช้ข้อความ  directory "/var/cache/bind";
### หากเป็น fedora ใช้ข้อความ  directory "/var/named";
        forward first;
           forwarders {
                10.0.0.5;
            };
};

แก้ไขเสร็จแล้ว ให้สั่ง reload name server ใหม่
หากเป็น ubuntu ใช้คำสั่ง
/etc/init.d/bind9 reload
หากเป็น fedora ใช้คำสั่ง
/etc/init.d/named reload

ทดสอบผลงานด้วยคำสั่ง
nslookup www.yahoo.com 127.0.0.1
ได้ผลประมาณว่า
Server:         127.0.0.1
Address:        127.0.0.1#53

Non-authoritative answer:
www.yahoo.com   canonical name = www.yahoo.akadns.net.
Name:   www.yahoo.akadns.net
Address: 209.191.93.52

ถึงตอนนี้แสดงว่า name server ของเราทำงานเป็นแบบ forward only  ได้แล้ว

4.หากต้องการทำเป็น caching only ด้วยก็ให้ทำต่อคือ
แก้ไขแฟ้ม /etc/resolv.conf เพิ่มข้อความว่า
name server 127.0.0.1 ไว้บนบรรทัดแรกสุด ประมาณว่า

nameserver 127.0.0.1
nameserver 10.0.0.5

หมายความว่า ให้เลือก query จากตนเองก่อน หากไม่พบ ก็ไปต่อที่ 10.0.0.5 

แก้ไขแค่นี้ ก็ใช้ได้แล้ว ไม่ต้องไป reload หรือ restart 
รอสัก 2 นาที แล้วลองทดสอบผลงานด้วยคำสั่ง
nslookup www.yahoo.com
ได้ผลประมาณว่า
Server:         127.0.0.1
Address:        127.0.0.1#53

Non-authoritative answer:
www.yahoo.com   canonical name = www.yahoo.akadns.net.
Name:   www.yahoo.akadns.net
Address: 209.191.93.52

แสดงว่าใช้งานได้แล้ว

5.หากต้องการทำเป็น name server สำหรับบริการทั่วๆไป
มีตนเองเป็น primary และมี myisp.domain.com เป็น secondary

หากเป็น ubuntu แก้ไขที่แฟ้ม /etc/bind/named.conf.local
หากเป็น fedora แก้ไขที่แฟ้ม /var/named/chroot/etc/named.conf  
****  ต้องยกเลิกหรือลบบรรทัดข้อความ(ถ้ามี)ว่า
        forward first;   ทิ้งออกไปด้วย
**** การใส่ comment ใน zone file ให้ใส่เครื่องหมาย ";" นำหน้า
ให้มีข้อมูล zone และ reserve zone ที่ต้องการ ดังตัวอย่าง
zone "mydomain.com" {
   type master;
   allow-query { any; };
   file "/etc/bind/my-domain.zone";
// หากเป็น ubuntu ต้องใส่ path ด้วยว่า file "/etc/bind/my-domain.zone"
// หากเป็น fedora ไม่ต้องใส่ path เหลือแค่ file "my-domain.zone"
};
zone "1.0.10.in-addr.arpa" {
  type master;
  file "10-0-1.zone";
// หากเป็น ubuntu ต้องใส่ path ด้วยว่า file "/etc/bind/10-0-1.zone"
// หากเป็น fedora ไม่ต้องใส่ path เหลือแค่ file "10-0-1.zone"
};

ต่อไปให้สร้างแฟ้ม zone ต่างๆ 
หากเป็น ubuntu แก้ไขแฟ้ม /etc/bind/my-domain.zone
หากเป็น fedora แก้ไขแฟ้ม /var/named/chroot/var/named/my-domain.zone
มีข้อมูลประมาณดังตัวอย่าง
$TTL    3D
@               IN SOA  ns.mydomain.com. (
                                        200611146       ; serial (d. adams)
                                        3H              ; refresh
                                        15M             ; retry
                                        1W              ; expiry
                                        1D )            ; minimum
                NS   ns

localhost       A       127.0.0.1
ns               A       10.0.1.3
myserver1    A       10.0.1.207
myserver2    A       10.0.1.208

ต่อไปให้สร้างแฟ้ม reverse zone 
หากเป็น ubuntu แก้ไขแฟ้ม /etc/bind/10-0-1.zone
หากเป็น fedora แก้ไขแฟ้ม /var/named/chroot/var/named/10-0-1.zone
มีข้อมูลประมาณดังตัวอย่าง
$TTL    3D
@               IN SOA  ns.mydomain.com. (
                                        200611142       ; serial (d. adams)
                                        3H              ; refresh
                                        15M             ; retry
                                        1W              ; expiry
                                        1D )            ; minimum
                NS   ns
                NS   mysip.domain.com

205             PTR     myserver1.mydomain.com.
207             PTR     myserver1.mydomain.com.

หากเป็น ubunt ให้ DNS ทำงานด้วยคำสั่ง
/etc/init.d/bind9 restart

หากเป็น fedora เมื่อสร้างแฟ้มเสร็จแล้ว ต้องเปลี่ยนสิทธิ์แฟ้มนี้ให้เป็นของ named ด้วยคำสั่ง
chown named.named /var/named/chroot/var/named/my-domain.zone
chown named.named /var/named/chroot/var/named/10-0-1.zone
เสร็จแล้วสั่งให้ DNS ทำงานด้วยคำสั่ง 
/etc/init.d/named restart

1. หลักสูตร ซ่อมบำรุงและดูแลรักษาเครื่องคอมพิวเตอร์ 
    1.1 รู้จักกับอุปกรณ์คอมพิวเตอร์
    1.2 การถอด-ประกอบ อุปกรณ์คอมพิวเตอร์
    1.3 การติดตั้งระบบปฏิบัติการ และ โปรแกรมประยุกต์
    1.4 การวิเคราะห์อาการเสียในเบื้องต้น
    1.5 การติดตั้งและอัพเดทโปรแกรมป้องกันและกำจัดไวรัสอย่างมีประสิทธิภาพ (แบบ Off line , On line)
    1.6 การประมาณราคาค่าติดตั้งและซ่อมบำรุง
ระยะเวลาในการฝึกอบรม  :  1 วัน (ฝึกอบรม 1 คน / 1 เครื่อง)
ค่าฝึกอบรม : 1300 บาท (หนึ่งพันสามร้อยบาทถ้วน)
ห้วงเวลาในการฝึกอบรม :  วันที่

2. หลักสูตร การติดตั้งระบบเครือข่ายคอมพิวเตอร์ และติดตั้งอินเทอร์เน็ตเซิร์ฟเวอร์ด้วยระบบปฏิบัติการ Linux
    2.1 ทฤษฎี ระบบเครือข่าย (LAN)  เบื้องต้น
    2.2 ปฏิบัติการติดตั้งระบบเครือข่าย LAN
    2.3 ปฏิบัติการติดตั้งเครื่องคอมพิวเตอร์แม่ข่ายด้วยระบบปฏิบัติการ Linux 
    2.4 ปฏิบัติการปรับแต่งเครื่องคอมพิวเตอร์แม่ข่าย ดังนี้
           2.4.1 ปรับแต่ง DHCP Server เพื่อแจกหมายเลข IP Address ให้กับเครื่องลูกข่าย
           2.4.2 ปรับแต่ง IPTABLES / Firewall เบื้องต้น เพื่ออนุญาตให้เครื่องลูกข่ายใช้งานอินเทอร์เน็ตได้
           2.4.3 ปรับแต่ง Squid Proxy Server  เพื่อเพิ่มความเร็ว และ Block Website ที่ไม่พึงประสงค์
ระยะเวลาในการฝึกอบรม  :  1 วัน (ฝึกอบรม 1 คน / 2 เครื่อง)
ค่าฝึกอบรม : 1500 บาท (หนึ่งพันห้าร้อยบาทถ้วน)
ห้วงเวลาในการฝึกอบรม :  วันที่

3. หลักสูตร การติดตั้งอินเทอร์เน็ตเซิร์ฟเวอร์สำหรับองค์กรด้วยระบบปฏิบัติการ Linux  
    3.1 ทฤษฎี ระบบเครือข่าย (LAN)  เบื้องต้น
    3.2 ปฏิบัติการติดตั้งระบบเครือข่าย LAN
    3.3 ปฏิบัติการติดตั้งเครื่องคอมพิวเตอร์แม่ข่ายด้วยระบบปฏิบัติการ Linux 
    3.4 ปฏิบัติการปรับแต่งเครื่องคอมพิวเตอร์แม่ข่าย ดังนี้
           3.4.1 DHCP Server เพื่อแจกหมายเลข IP Address ให้กับเครื่องลูกข่าย
           3.4.2 IPTABLES / Firewall เบื้องต้น เพื่ออนุญาตให้เครื่องลูกข่ายใช้งานอินเทอร์เน็ตได้
           3.4.3 Squid Proxy Server  เพื่อเพิ่มความเร็ว และ Block Website ที่ไม่พึงประสงค์
           3.4.4 Web Server  เพื่อใช้เก็บเว็บไซท์ขององค์กร ทั้งในรูปแบบ Intranet Server / Internet Server
           3.4.5 FTP Server เพื่อใช้ในการอัพโหลด/ดาวน์โหลดข้อมูลผ่านเครื่องคอมพิวเตอร์แม่ข่าย และการป้องกันไม่ให้ User ออกนอกพื้นที่ของตนเอง
           3.4.6 การแบ่งพื้นที่โฮมเพจให้กับ หน่วยงาน/แผนก/ฝ่าย ต่าง ๆ 
           3.4.7 การจำกัดพื้นที่โฮมเพจ
           3.4.8 Mail Server เพื่อใช้ในการรับ-ส่ง อีเมล์ สำหรับใช้ภายในและภายนอกองค์กรแบบ Intranet Server / Internet Server
           3.4.9 Mysql Server / Database Server เพื่อใช้เป็นฐานข้อมูล
           3.4.10 การติดตั้ง PHP-Myadmin ภาษาไทยเพื่อใช้ในการจัดการฐานข้อมูล
           3.4.11 Samba Server เพื่อใช้เก็บข้อมูลของแต่ละบุคคลและควบคุมการใช้งานด้วย User , Password
ระยะเวลาในการฝึกอบรม  :  2 วัน (ฝึกอบรม 1 คน / 2 เครื่อง)
ค่าฝึกอบรม : 1900 บาท (หนึ่งพันเก้าร้อยบาทถ้วน)
ห้วงเวลาในการฝึกอบรม :  วันที่

4. หลักสูตร การติดตั้งอินเทอร์เน็ตเซิร์ฟเวอร์สำหรับองค์กรแบบ Authentication ด้วยระบบปฏิบัติการ Linux  
(พิสูจน์ตัวบุคคลด้วยการกรอก User Name : Password ก่อนใช้งานอินเทอร์เน็ต) เพื่อรองรับ พรบ.ว่าด้วยการกระทำความผิดเกี่ยวกับคอมพิวเตอร์ พ.ศ. 2550 โดยระบบสามารถรองรับระบบเครือข่าย LAN และ ระบบอินเทอร์เน็ตไร้สายได้ 100 %
    4.1 ทฤษฎี ระบบเครือข่าย (LAN)  เบื้องต้น
    3.2 ปฏิบัติการติดตั้งระบบเครือข่าย LAN
    3.3 ปฏิบัติการติดตั้งเครื่องคอมพิวเตอร์แม่ข่ายด้วยระบบปฏิบัติการ Linux 
    3.4 ปฏิบัติการปรับแต่งเครื่องคอมพิวเตอร์แม่ข่าย ดังนี้
           3.4.1 DHCP Server (Chilli) เพื่อแจกหมายเลข IP Address ให้กับเครื่องลูกข่าย
           3.4.2 IPTABLES / Firewall เบื้องต้น เพื่ออนุญาตให้เครื่องลูกข่ายใช้งานอินเทอร์เน็ตได้
           3.4.3 Squid Proxy Server  เพื่อเพิ่มความเร็ว และ Block Website ที่ไม่พึงประสงค์
           3.4.4 Web Server  เพื่อใช้เก็บเว็บไซท์ขององค์กร ทั้งในรูปแบบ Intranet Server / Internet Server
           3.4.5 Mysql Server / Database Server เพื่อใช้เป็นฐานข้อมูล
           3.4.6 การติดตั้ง PHP-Myadmin ภาษาไทยเพื่อใช้ในการจัดการฐานข้อมูล
           3.4.7 การติดตั้งระบบการจัดการผู้ใช่งานผ่าน Browser
           3.4.8 การจัดการฐานข้อมูลผู้ใช้ เช่น เพิ่ม - ลบ User / Group ในกรณีที่มี User จำนวนมาก ๆ
           3.4.9 การจำกัดเวลาใช้งานของแต่ละ User / Group
           3.4.10 การติดตาม ตรวจสอบการใช้งานอินเทอร์เน็ตของ User 

ระยะเวลาในการฝึกอบรม  :  2 วัน (ฝึกอบรม 1 คน / 2 เครื่อง)
ค่าฝึกอบรม : 2400 บาท (สองพันสี่ร้อยบาทถ้วน)
ห้วงเวลาในการฝึกอบรม :  วันที่

ที่มา : http://ns1.kk.ac.th/kk/download/Example-Config.txt
Categories: ข่าวประชาสัมพันธ์, เขียนโปรแกรม | ใส่ความเห็น

แนะแนวเรื่อง

แสดงความเห็นเกี่ยวกับเรื่องนี้

สร้างเว็บไซต์หรือบล็อกฟรีที่ WordPress.com.