Posts

Showing posts from July, 2007

Linux - Compile kernel 2.6

Prepare compiler # yum install gcc Download the latest kernel from http://www.kernel.org/ # cd /tmp # wget http://kernel.org/pub/linux/kernel/v2.6/linux-2.6.22.1.tar.bz2 Extract tar file: # mv linux-2.6.22.1.tar.bz2 /usr/src # tar -xjvf linux-2.6.22.1.tar.bz2 # cd /usr/src Configure kernel # make menuconfig (Text based menus) (optional) # make xconfig (KDE configuration tool) (optional) # make gconfig (GNOME configuration tool) (select different options depends on your own environment) Compile kernel # make # make modules # make modules_install Install kernel # make install (three files installed into /boot directory) (System.map-2.6.22.1) (config-2.6.22.1) (vmlinuz-2.6.22.1) Create an initrd image: # cd /boot # mkinitrd -o initrd.img-2.6.22.1 2.6.22.1 Modify grub # vi /boot/grub/menu.lst title Debian GNU/Linux, kernel 2.6.22.1 Default root (hd0,0) kernel /boot/vmlinuz root=/dev/hdb1 ro initrd /boot/initrd.i...

免費電腦技術雜誌

Image
http://www.pctech.com.hk/ 免費訂閱 !

The Sysadmin Song

螞蟻 蚊子 蟑螂...殺殺殺!!!

螞蟻怕酸味 - 新鮮檸檬切成兩半,在看得到螞蟻的地方及其動線,擠出檸檬汁,並拿著切半有果肉的那一面,沿途塗抹。 蚊子怕辣味 - 蒜頭植於花壇四周,特殊的辛辣味隱隱飄散。令人訝異的是。 蟑螂怕香味 - 香皂切成數小塊,置於容器內注入清水,擺放在蟑螂出沒的櫥櫃內。想要效果持續,須定期補充香皂容器內的清水

Solaris - Terminal & Backspace

To use the [backspace] key in Solaris Terminal # stty erase [backspace]

Linux - SSH basic security setting

edit sshd config file # vi /etc/ssh/sshd_config Add the lines : AllowUsers [userloginname] PermitRootLogin no PermitEmptyPasswords no PasswordAuthentication yes MaxAuthTries 5 restart ssh # service sshd restart Use pam_access to restrict SSH connection

Linux - Useful vi function

Input : a、i、o First Line : gg Last Line : G Goto Line : xxG Goto neginning of line : 0 Goto end of line : $ Copy line : yy Paste : p Undo : u Delete word : x Delete line : dd Show Line No. : :set nu Hide Line no. : :set nonu Goto shell : :sh(back to vi : exit)

Linux - send mail through SMTP

fromhost (helo 後面跟的 domainname) mail from (寄信人) rcpt to (收信人) Yip@localpc:~> telnet mailsvr 25 Trying 123.123.123.123... Connected to mailsvr. Escape character is '^]'. 220 mailsvr.domain.com ESMTP Sendmail 8.8.8/8.8.8; Thu, 21 May 1998 20:45:51 +0800 (CST) helo localpc 250 mailsvr.domain.com Hello Yip@localpc.domain.com [140.116.72.74], pleased to meet you mail from: 250 ... Sender ok rcpt to: 250 ... Recipient ok data 354 Enter mail, end with "." on a line by itself mail from telnet mailsvr port 25 . 250 UAA02587 Message accepted for delivery quit 在 rcptmailsvr 收到的信件如下 From Yip@mailsvr.domain.com Thu May 21 20:36:29 1998 Received: from mailsvr.domain.com (mailsvr [123.123.123.123]) by rcptmailsvr.domain.com (8.8.5/8.8.5) with ESMTP id UAA05162 for ; Thu, 21 May 1998 20:36:29 +0800 (CST) Received: from localpc (Yip@localpc.domain.com [140.116.72.74]) by mailsvr.domain.com (8.8.8/8.8.8) with SMTP id UAA02587 for ; Thu, 21 May 1998 ...

Linux - SELinux

Permissive mode: switch the SELinux kernel into a mode where every operation is allowed. Operations that would be denied are allowed and a message is logged identifying that it would be denied. The mechanism that defines labels for files which are being created/changed is still active. Disabled mode: SELinux is completely switched off in the kernel. This allows all operations to be permitted, and also disables the process which decides what to label files & processes with. Temporarily switch off enforcement > echo 0 >/selinux/enforce > newrole -r sysadm_r Temporarily switch on enforcement > echo 1 >/selinux/enforce Permanently Permissive > vi /etc/selinux/config ... # permissive - SELinux prints warnings instead of enforcing. # disabled - No SELinux policy is loaded. SELINUX=enforcing # SELINUXTYPE= can take one of these two values: # targeted - Only targeted netwo ... (Other thatn RedHat Linux) > vi /boot/grub/grub.conf ... ...

Linux - Kill multiple processes

# kill -9 `ps -ef | grep rdist | grep -v grep | awk '{print($2)}'`

Linux - sed : search & replace

# sed -i ’s/src_str/new_str/g’ filename