Tuesday, April 30, 2013

debian start-stop-daemon issue

Fresh installed debian, you may find empty (exit 0;) /sbin/start-stop-daemon file which causes you be unable to start sshd, for example.  To resolve this:

apt-get install --reinstall dpkg

Friday, April 26, 2013

how to change default kernel selection at boot time - linux

สุดท้ายแก้ไขไปพลางด้วยการ vi /etc/default/grub ใส่ DEFAULT="1>2" ตามด้วย update-grub ใช้ kernel 3.5.0-26 ไปก่อนดีกั่ว

Friday, April 19, 2013

how to record desktop screen in linux

ffmpeg -f x11grab  -s 1680x1050 -r 25 -i :0.0 -sameq live_streaming_issue.mpg

Tuesday, April 16, 2013

how to limit number of connections to server per second with iptables

# 2 hits per second per ip address

iptables -A INPUT -p tcp --dport 80 -i eth0 -m state --state NEW -m recent --set
iptables -A INPUT -p tcp --dport 80 -i eth0 -m state --state NEW -m recent --update --seconds 1 --hitcount 2 -j DROP

iptables -A INPUT -p tcp --dport 443 -i eth0 -m state --state NEW -m recent --set
iptables -A INPUT -p tcp --dport 443 -i eth0 -m state --state NEW -m recent --update --seconds 1 --hitcount 2 -j DROP