วันพฤหัสบดีที่ 15 ธันวาคม พ.ศ. 2554

Reset password root ใน mysql ของ CentOS

Reset password root ใน mysql ของ CentOS  

จดเอาไว้กันลืม สำหรับการ Restart Password ของ mysqld เวลาลงครับ
1. ให้หยุดการทำงานของ mysql ก่อน
# service mysqld stop
2. ให้ Start MySQL เป็น save mode. โดยคำสั่ง
# mysqld_safe --skip-grant-tables &
3. ต่อไปก็ให้ Login  MySQL โดย user root
# mysql -u root
4. ทำการ Update password root (ที่ขีดเส้นใต้คือให้ใส่รหัสใหม่ลงไป)
mysql> use mysql;
mysql> update user set password=PASSWORD("NEW PASSWORD") where user='root';
mysql> flush privileges;
mysql> quit;
5. แล้วก็ restart service ของ mysql ซะ เป็นอันเรียบร้อย
# service mysqld restart
6. แล้วลองเข้าใหม่ดูครับ
# mysql -u root -p
7.พอเข้าได้แล้ว ก็ไปเข้าของ phpmyadmin เอาด้วย ก็น่าจะเข้าได้เช่นกันครับ

วันพุธที่ 2 พฤศจิกายน พ.ศ. 2554

HOW TO ADD [DAG] ON CENTOS 5 2/11/2011 :)

# Insert This Command at /etc/yum.repos.d/CentOS-Base.repo


[dag]
name=Dag RPM Repository for Red Hat Enterprise Linux
baseurl=http://ftp.heanet.ie/pub/freshrpms/pub/dag/redhat/el5/en/i386/dag/
gpgcheck=1
enabled=1

// Save And Exit

#yum claen all
#yum list all
#yum update

Hav a fun :)

วันพุธที่ 1 มิถุนายน พ.ศ. 2554

วันจันทร์ที่ 30 พฤษภาคม พ.ศ. 2554

UPDATE [DAG] FOR smbldap-tools 30/05/2011 :>

       The default RPMforge repository does not replace any CentOS base packages. In the past it used to, but those packages are now in a separate repository (rpmforge-extras) which is disabled by default.
You can find a complete listing of the RPMforge package packages at http://packages.sw.be/
Download the rpmforge-release package. Choose one of the two links below, selecting to match your host's architecture. If you are unsure of which one to use you can check your architecture with the command uname -i
The preferred rpmforge-release package to retrieve and to install in order to enable that repository is one of the two listed above.
Install DAG's GPG key
rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
Verify the package you have downloaded
rpm -K rpmforge-release-0.5.2-2.el5.rf.*.rpm
<!> Security warning: The rpmforge-release package imports GPG keys into your RPM database. As long as you have verified the md5sum of the key injection package, and trust Dag, et al., then it should be as safe as your trust of them extends.
Install the package
rpm -i rpmforge-release-0.5.2-2.el5.rf.*.rpm
This will add a yum repository config file and import the appropriate GPG keys.
Then try to install something like this
yum install htop

วันเสาร์ที่ 28 พฤษภาคม พ.ศ. 2554

วิธี set iptables บน linux แบบง่ายๆ 29/05/2011

วิธี set iptables บน linux แบบง่ายๆ


ACCEPT = ยอมให้ผ่าน
DROP = ไม่สนใจแพ็กเกต
REJECT = ไม่สนใจเหมือนกัน แต่ จะแจ้งให้ เราทราบ
 
 
iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -j ACCEPT
iptables -A OUTPUT -p tcp -s 192.168.0.0/24 -j DROP
iptables -A OUTPUT -p tcp -d 192.168.0.0/24 -j DROP
 
 
#### ถ้าต้อง การให้ firwall ปล่อยให้ port ไหน ผ่าน ให้ เปลี่ยน ตัวเลขของ port
 
iptables -A FORWARD -p tcp -s 192.168.0.0/24 --destination-port 80 -j ACCEPT
 
iptables -A FORWARD -p tcp -d 192.168.0.0/24 --destination-port 80 -j ACCEPT
 
 
#### Block MSN
iptables -A INPUT -p tcp -s 192.168.0.0/24 --destination-port 1836 -j DROP
iptables -A INPUT -p tcp -d 192.168.0.0/24 --destination-port 1836 -j DROP
iptables -A FORWARD -p tcp -s 192.168.0.0/24 --destination-port 1836 -j DROP
iptables -A FORWARD -p tcp -d 192.168.0.0/24 --destination-port 1836 -j DROP

Have a fun... :-)