Category Archives: System Administration

why squid listen on high udp port number

When starting squid with the default configuration (compiled from source), you may notice that the squid process listens not only on TCP port 3128, but also a high UDP port. netstat -tlunp | grep squid tcp 0 0 :::3128 :::* … Continue reading

Posted in System Administration | Tagged , , | Leave a comment

Linux系统编程知识在运维排错中的应用

1.    谁偷了我的磁盘空间? 发现大小为10G的/home分区磁盘空间使用了9.8G,但是通过du得到的大小却是5G. 另外的4.8G空间哪里去了呢? df -Th /home Filesystem    Type    Size  Used Avail Use% Mounted on /dev/sda3      ext3     10G   9.8G  0.2G  98% /home du -hs /home 5.0G    /home/ du和df都不太可能出错,文件系统也没有损坏的迹象,那问题出在哪儿呢?查看unlink系统调用的手册页:

Posted in Programming, System Administration | Tagged , , | Leave a comment

Bash quote trap: why rsync exclude pattern not work

A friend wanted to sync all his files to a remote host, exluding the source files(those with suffix .c, .cpp, .h, .hpp). First I wrote this script #!/bin/bash ####sync.sh (version 1): sync files to remote host### SYNC_DST=’xxx@example.com::sample_project’ SYNC_OPT=’ –exclude=”*.[ch]” –exclude=”*.[ch]pp” … Continue reading

Posted in Bash, Programming, System Administration | Tagged , , , | 2 Comments

add utf8 subject support to mailwatch 1.0.5

In mailwatch v1.0.5, if the subject of a message is utf8 encoded, it can’t display correctly on the message list page. All the non-ascii characters will be replaced with question mark. For example. the subject “我爱Linux” will appears as “??Linux”. … Continue reading

Posted in Email, System Administration | Tagged | Leave a comment

Apache options directive trap

When configuring the Apache HTTP server, we use the Options directive to control which server features are available in a particular directory. We may, for example, write a config like this: <Directory /usr/share/nagios> Options +ExecCGI Indexes FollowSymLinks … </Directory> With … Continue reading

Posted in System Administration, Web | Tagged , | Leave a comment

Build the Linux kernel for other host

Building the linux kernel is time and resource consuming, especially when you do this in a VM guest. fortunately, We can choose a fast Linux machine to take the burden of building, then install the kernel to the target Linux … Continue reading

Posted in System Administration | Tagged , , | Leave a comment

Install from source or use rpm, this is a question

Install software packages from prebuilt rpm is not always simple and good. If we need more configure option and consistent behavior, build from source Continue reading

Posted in System Administration | Tagged , | Leave a comment

Shorewall: allow communication between VPN clients

If you setup Linux as a PPTP or L2TP/IPSec VPN server, every client connection will have a corresponding pppx interface on the server. You may have a shorewall interface config like this: /etc/shorewall/interfaces #zone interface boradcast options l2tp ppp+ – … Continue reading

Posted in System Administration, VPN | Tagged , , , | Leave a comment

Create new KVM guest from template

Most of us don’t like to install guest OS repeatedly, instead, we often install one guest OS, then do some setup and customization. After that, we make a backup of the disk image(We use it as a template). If we … Continue reading

Posted in Programming, Python, System Administration, Virtualization | Tagged | 3 Comments

A convenient Bash function to backup configuration file

For sysadmins, it’s a good practice to backup configuration files before changing them. We normally do it via cp. eg: cp named.conf named.conf.bak cp named.conf named.conf.orig I personally like to use the date time as the file name suffix, so … Continue reading

Posted in Programming, System Administration | Tagged , | Leave a comment