Wednesday, February 27, 2013

debian fresh install can't start services under /etc/init.d

If for any reason you can't start any services under /etc/init.d after a fresh installation of debian, you may try "apt-get install --reinstall dpkg"

Friday, February 15, 2013

iptables slow down http and https

With:

-P INPUT DROP
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 443 -j ACCEPT

Websites on the server will response very slowly.

But if you add:

 -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT

 Websites will response fast as usual.

Saturday, February 9, 2013

how to mount samba fs to directory in linux


mount //some_server/share /home/grml/smbfs/share -o "user=share,password=****,uid=grml,gid=grml"

but if your password is complex (e.g. contains special characters), better use -o "credentials=/path/to/credential"

credential file format is:

username
password

On Debian 7.0, you will need to "apt-get install cifs-utils" first to get mount.cifs.

Wednesday, December 26, 2012

how to disable annoying Super Key in Ubuntu Linux with Unity Window Manager

First I should say that Super brings up the big overlay grid, that is called the Dash. Tappipng Alt brings up the HUD, a smaller text field in the top left. It's a 'type-a-little' interface to all the commands in system and application menus. We can get a link for more info, if needed.
So you can shut off the Super key, with the low-level tool Compiz Config Settings Manager. The package name is compizconfig-settings-manager, if it's not installed yet.
Open the Dash, and type 'ccsm'. You should see an icon you can run. When the app opens, you may get a warning that it's a tool that can mess up your system. This is true; it doesn't have any constraints on choosing settings that may break your desktop in different ways. But this change alone will be ok.
In CCSM, find and choose 'Ubuntu Unity Plugin'. The first tab, Behavior, should have an item 'Key to show the launcher'. Click on the button that shows Super, and you can disable it, or choose a different key if you want to try that.
Notes:
- this is how it looks for me under 12.10. It's about the same, as I recall, under 12.04.
- It should probably say 'Key to show the dash'. Maybe I'll find or file a bug about that.
- unchecking 'Enable Ubuntu Unity Plugin', under Unity, is the kind of thing that would send your window controls, and lots of the UI, into never-never land.


Reference


Wednesday, December 19, 2012

harddisk ของ Western Digital มีปัญหากับ RAID-1

หากท่านนำ harddisk ของ Western Digital มาใส่เป็น member ของ RAID-1 ท่านจะพบปัญหาการ rebuild ไม่จบ โดย status ของ raid เมื่อดูด้วย mdadm จะเป็น clean, degraded และ spare rebuilding

สาเหตุเกิดจาก module NCQ ใน harddisk ท่านต้อง disable ที่ sysctl.conf เพิ่มบรรทัด (สมมติ harddisk ลูกนั้นคือ /dev/sdb):

block/sdb/device/queue_depth=1


References

swap file

You can use file as swap space.

dd if=/dev/zero of=/var/swap bs=1M count=10240
mkswap swap
swapon /var/swap
chmod 0600 swap


Add this into /etc/fstab

/var/swap       swap    swap    defaults        0 0

Wednesday, November 21, 2012

How to change network interface descriptor (eth0, eth1, ...) in Linux

Easy easy. Just edit the file:


/etc/udev/rules.d/xxx-persistent-net.rules

ความย่อยยับของแนวทางการตั้งรหัสผ่านแบบยากๆ

บ้าไปแล้ว ช่วงนี้พบการเปลี่ยนแปลงของเว็บไซต์ใหญ่ๆเช่น GoDaddy และ PayPal ในช่องกรอกรหัสผ่าน (password) ขณะนี้ไม่สามารถ copy จากไฟล์รหัสผ่านที่ผมจดไว้แล้วมา paste ไปในช่องนี้ได้ ซึ่งมีทางเลือกให้ผม 2 ทาง ได้แก่
  1. นั่งพิมพ์รหัสผ่านทีละตัว เพื่อ log in
  2. เคาะ space หนึ่งทีก่อนเพื่อหลอก JavaScript ว่าเราพิมพ์เองแล้ว จากนั้น paste รหัสผ่านลงไป แล้วกลับมาที่ character แรกเพื่อลบ space อันเดียวนั้นออก เพื่อ log in
คือ... มันบ้าไปแล้วหรอครับ บังคับให้มานั่งพิมพ์รหัสผ่านเองด้วยมือหรอ แฝงความนัยว่า อยากสนับสนุนให้ user ตั้งรหัสผ่านง่ายๆ ที่สามารถจำได้ด้วยมันสมองอันน้อยนิดของมนุษย์หรอครับ
บอกกัน สนับสนุนกันตลอดให้ตั้งรหัสผ่านยากๆไม่ใช่หรอ? แล้ว feature ใหม่นี้คืออะไร???

จะตั้งรหัสผ่านยากๆ ผมก็ทำอยู่ รหัสผ่านส่วนใหญ่ผมก็ประมาณนี้:

jkskk##%%Xax134_SkxmknKSKq233jkhMnjklszP

แล้วผมก็จดใส่ไฟล์ที่อยู่ใน partition ที่เข้ารหัสของผมด้วย dm-crypt หรือ ecryptfs ซึ่งมีความปลอดภัยสูงในระบบปฎิบัติการ Linux เวลาใช้งานผมก็ copy and paste สิครับ

พระเจ้าช่วย... ไม่เข้าใจเลยจริงๆ ทำอะไรของมันกันเนี่ย

หลัง upgrade openssl แล้วไม่สามารถ ssh เข้า server ได้

ใน Debian บาง version หากท่านทำการ upgrade openssl แล้ว ไม่สามารถ ssh เข้าเครื่องได้ ไม่ต้องตกใจ ให้ลอง upgrade openssh-server ดูด้วยครับ

สอง package นี้น่าแปลกที่ไม่มี dependency ต่อกันเวลาใช้ apt-get แต่กลับมีการ reference ถึงกันในบาง configuration file