Archive for September, 2007
Thursday, September 27th, 2007
เมื่อเราต้องการรู้ว่าเครื่อง Linux ของเราได้ทำการเปิด socket ของ process นี้กี่ socket แล้ว สามารถทำตามวิธีข้างล่างนี้ได้เลย โดยขั้นแรกจะต้องหา PID ของ process นั้นๆก่อน โดยใช้คำสั่ง
$ ps -aef | grep processname
pbat 4750 4437 0 07:03 ? 00:00:00 processname
เมื่อเราได้ค่า PID ของ process แล้วจะนำค่านี้ไปหาจำนวน socket ที่ได้เปิดใช้งานแล้วโดยใช้คำสั่ง
$ ls -l /proc/4750/fd | grep -c — ‘-> socket:’
8
หลังจากใช้คำสั่งแล้วจะเห็นจำนวนของ socket ที่เปิดใช้งานแล้ว ในตัวอย่างจะเท่ากับ 8 socket
Permanent link to this post (53 words, estimated 13 secs reading time)
No tag for this post.
Posted in System | No Comments »
Thursday, September 27th, 2007
ใน RHEL 5 สามารถรองรับ file system ได้ถึง 8 TB และจะยังสามารถรองรับ file system ได้มากถึง 16 TB ในอนาคต แต่เมื่อทำการสร้าง file system ขึ้นมาจริงๆแล้ว ไม่สามารถสร้าง file system ได้ถึง 8 TB แต่สามารถสร้างได้มากสุดแค่ 2 TB เท่านั้น แต่ผมมีวิธีแก้ที่จะทำให้สามารถสร้าง file system ได้ถึง 8 TB ตามที่ Red Hat ได้ประกาศไว้ครับ โดยทำตามวิธีดังนี้ โดยที่สมมติว่าใช้กับ LVM นะครับ
ขั้นแรกสร้าง pv ขึ้นมาก่อน และกำหนดชื่อเป็น BiggerGroup ดังคำสั่งด้านล่าง
#pvcreate /dev/sda
#vgcreate BiggerGroup /dev/sda
ต่อมาสร้าง lv จาก BiggerGroup ครับโดยใช้ชื่อ biggervol
#lvcreate -L 16000G -n biggervol BiggerGroup
ขั้นต่อมาเป็นการ format file system ครับ ขั้นตอนนี้สำคัญมากๆครับ โดยเราจะต้องใส่ option -F และกำหนด block size เป็น 4096 ดังคำสั่งด้านล่างครับ
#mkfs.ext3 -F -b 4096 /dev/BiggerGroup/biggervol
Permanent link to this post (88 words, estimated 21 secs reading time)
No tag for this post.
Posted in HDD Management | No Comments »
Tuesday, September 25th, 2007
ผมมีรูปรายละเอีบดของ directory มาฝากครับ สำหรับมือใหม่ Ubuntu และสาวก Ubuntu ที่บางท่านที่ยังไม่ทราบรายละเอียดต่างๆของ Directory ว่าอะไรเก็บอยู่ที่ไหนบ้าง

ขอขอบคุณ: คุณ Scott Gilbertson จาก wired มากๆครับ
Permanent link to this post (18 words, 1 image, estimated 4 secs reading time)
No tag for this post.
Posted in System | No Comments »
Monday, September 24th, 2007
เราสามารถใช้คำสั่ง netstat ดูรายละเอียดต่างๆของ network ได้โดยใช้คำสั่งข้างล่างนี้
[root@example ~]# netstat -tuanpeeoT
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State User Inode PID/Program name Timer
tcp 0 0 0.0.0.0:2049 0.0.0.0:* LISTEN 0 3117421 - off (0.00/0/0)
tcp 0 0 0.0.0.0:1002 0.0.0.0:* LISTEN 0 3117348 12270/rpc.rquotad off (0.00/0/0)
tcp 0 0 0.0.0.0:57071 0.0.0.0:* LISTEN 0 3117432 - off (0.00/0/0)
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 0 9850 2674/portmap off (0.00/0/0)
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 0 13340126 3009/cupsd off (0.00/0/0)
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 0 1011109 3115/sendmail: acce off (0.00/0/0)
This is a preview of
View extended information about network connections using netstat?
.
Read the full post (294 words, estimated 1:11 mins reading time)
Posted in Network | No Comments »
Tuesday, September 11th, 2007
การป้องกันไม่ให้ ssh เข้าเครื่องโดย Login เป็น root สามารถแก้ไขที่ไฟล์
#vi /etc/ssh/sshd_config
ตรงส่วนของ PermitRootLogin ให้เป็น no ดังข้างล่าง
PermitRootLogin no
จากนั้นให้ restart ssh โดยพิมพ์
#service sshd restart
Stopping sshd: [ OK ]
Starting sshd: [ OK ]
เมื่อทำการแก้ไขเรียบร้อยแล้วจะไม่สามารถ Login โดยใช้ root ได้ ดังนั้นจึงต้อง Login เป็น user อื่นก่อนแล้วค่อยใช้คำสั่ง su เปลี่ยนเป็น root โดยพิมพ์
#su - root
Permanent link to this post (62 words, estimated 15 secs reading time)
Tags:
disable root login,
Remote,
SSH
Posted in SSH/Telnet | No Comments »
Tuesday, September 11th, 2007
เพื่อความปลอดภัยจากการใช้งาน ssh เราสามารถตั้งค่าให้ระบบ logout user ที่ไม่ได้ใช้งานหลังจาก 15 นาทีผ่านไปแล้ว โดยการแก้ไขตามคำสั่งด้านล่าง
#vi /etc/ssh/sshd_config
และหาบรรทัดและแก้ไขให้เหมือนข้อความตามด้านล่าง
ClientAliveInterval 15m # 15 minutes
ClientAliveCountMax 0 # 0 times
จากนั้นพิมพ์
#service sshd restart
Permanent link to this post (40 words, estimated 10 secs reading time)
No tag for this post.
Posted in SSH/Telnet | No Comments »
Monday, September 10th, 2007
จากบทความที่แล้วเรื่องการติดตั้ง mrtg กับ IOSTAT ซึ่งเป็นการติดตั้งวิธีการที่ประยุกต์เอาคำสั่งพวก Monitor tools มาช่วยในการทำงานกับ mrtg ซึงแตกต่างจากหลักการทั่วไปที่ส่วนมากจะนำ SNMP มาใช้ในการส่งข้อมูลสถานะต่างๆให้กับ mrtg และในบทความนี้จะพูดถึงการนำ SNMP มาใช้งานกับ mrtg ซึ่งเป็นวิธีที่มีความนิยมใช้งานกันอย่างแพร่หลายมากกว่าการติดตั้ง mrtg กับ IOSTAT เพื่อไม่ให้เป็นการเสียเวลาเรามาเริ่มกันเลยดีกว่า
This is a preview of
Use SNMP and MRTG to monitor CPU, MEM and Disk use status
.
Read the full post (550 words, estimated 2:12 mins reading time)
Posted in Network | No Comments »
Monday, September 10th, 2007
เมื่อต้องการดูค่า parameter การบูตของ kernel สามารถใชัคำสั่ง
# cat /proc/cmdline
ro root=LABEL=/ rhgb quiet
Permanent link to this post (24 words, estimated 6 secs reading time)
No tag for this post.
Posted in System | No Comments »
Monday, September 10th, 2007
โดยทั่วไป Hard disk จะมีการเก็บ binary code ของ system boot loader เอาไว้ที่ 512 sector หรือ 512 Byte แรก ดังนั้นถ้าต้องการลบข้อมูลใน MBR สามารถใช้คำสั่ง
#dd if=/dev/zero of=/dev/ bs=512 count=1
คำเตือน: ถ้าทำการลบ MBR ไปแล้วเครื่องจะไม่สามารถบูตได้
Permanent link to this post (46 words, estimated 11 secs reading time)
No tag for this post.
Posted in System | No Comments »