Linux

Burapha Linux Server FAQ


home | progress | about | bugs | install

FAQ

This is the Burapha Linux Server Frequently Asked Questions (FAQ) list. Here we try and answer the common questions people have about Burapha Linux Server. If you cannot find the answer to your question here or elsewhere on the website, you can contact us and we will try and answer your question.

  1. How can I run BLS in a virtual machine?
  2. Why is Thai support missing?
  3. Why not use FreeBSD, OpenBSD, or NetBSD?
  4. Why not Red Hat/SuSE/Debian/Slackware?
  5. Can I get a machine with BLS pre-installed?
  6. How to setup ssh without password?
  7. How do I know what kernel version I am running?
  8. What is the difference between the the server installation and the client installation?
  9. Why not use LinuxTLE?
  10. Why is OpenLDAP not working with PHP?
  11. How can I setup mysql replication?
  12. Why does my networking hang?
  13. How do I print to my laserjet that uses an HP JetDirect card?
  14. How can I make the 'su' command work?
  15. How can I use files greater than 32MB?
  16. How can I setup remote system logging?
  17. How can I check if OpenLDAP is working?
  18. How can I use Mysql with PHP?
  19. How can I control volume on my CMI9739 sound chip?
  20. How can I use user/group quotas?
  21. Why should I use BLS?
  22. Help! I cannot ssh to my BLS server!
  23. I want GNOME
  24. I want KDE
  25. I want laptop support
  26. How can I add all the users to 'canlogin' group?
  27. How can I add new users and groups?
  28. How can I backup my data?
  29. How can I schedule tasks to be run later or periodically?
  30. How can I upgrade my BLS software?
  31. How can I setup anonymous FTP service?
  32. How can I setup WWW service?
  33. How can I support user ${HOME}/public_html web pages?
  34. How can I setup anonymous rsync service?
  35. How can I use apache instead of lighttpd?
  36. How can I stream ogg audio?
  37. How can I add a desktop icon for an application in xfce4?
  38. How can I add a menu item for an application in xfce4?
  39. How can I add a panel item for an application in xfce4?
  40. How can I add a second hard disk for data storage?
  41. How can I add a second hard disk for more /home?
  42. How can I use my Solomon air card?
  43. How can I use software RAID5?
  44. How can I stop getting the Fail2Ban email as root in my inbox?
  45. How can I set my firefox to default Thai mode?
  46. How can I used curl-loader for simple testing?
  47. How can I password protect a directory when I use lighttpd?
  48. How can I add/remove/change LAN cards?
  49. How can I use nc6 to check a web server?

How can I run BLS in a virtual machine?

Please see the instructions for running BLS inside of QEMU on a BLS client machine.


Why is Thai support missing?

The BLS development is done by John Ham, who does not know Thai. The Thai people at Burapha prefer Microsoft Windows and see adding Thai support to BLS as a waste of time.


Why not use FreeBSD, OpenBSD, or NetBSD?

These BSD operating systems are all good open source operating systems. However, fewer people use them. This means getting help for installation, configuration, and such will be more difficult. Most documentation for these systems assumes you are familiar with Unix already. To be fair, the BSD machines have superior behavior under heavy network load, but worse behavior under heavy disk load. Their virtual memory system is also better in a worst-case situation, but worse on a lightly loaded workstation. You can learn more here:


Why not Red Hat/SuSE/Debian/Slackware?

Red Hat is the most popular linux distribution. SuSE is the most popular linux distribution in Europe. Debian is a popular distribution among technical users. Slackware is the oldest distribution still in common use, and is the basis for the BLS. Any of these distributions will work on any machine that BLS runs on. However, these distributions are much harder to install and usually require more resources than BLS does. They provide more options, and have more packages. This means they are necessarily more complex to install and configure. BLS is designed to be easy to install so you can start using it right away without a lot of special technical skill.


Can I get a machine with BLS pre-installed?

No. However, if you bring your machine to us, we can assist you with installing the software.


How to setup ssh without password?

This seems to confuse a lot of people. All of the commands I show here are run on the machine you want to connect from. That is, when I say 'user@host' I mean the username on the remote host specified by 'host'. So if you want to connect as user joe on machine tserver.mycorp.co.th to a machine funblog.org as user larry, then you will use 'larry@funblog.org' everywhere I use 'user@host'. When you are asked for a password, it will be the password larry.

cd
ssh-keygen -t rsa
ssh user@host mkdir -p .ssh
cat .ssh/id_rsa.pub | \
ssh user@host 'cat >>.ssh/authorized_keys'
ssh user@host chmod 640 .ssh/authorized_keys

How do I know what kernel version I am running?

There are two easy ways to determine the kernel version you are running. The first way is to use the command:

$uname -a
Linux www.buraphalinux.org 2.6.32.7 #1 SMP Fri Jan 29 16:17:32 ICT 2010 x86_64 GNU/Linux

The first element is 'Linux', the second element is your hostname 'www.mydomain.net', the third element is your version. You can do man uname to learn more.

The second easy way to determine the kernel version is to use the command:

$cat /proc/verison
Linux version 2.6.32.7 (nobody@www.buraphalinux.org) (gcc version 4.3.4 (crosstool-NG-1.5.3) ) #1 SMP Fri Jan 29 16:17:32 ICT 2010

The 3rd element is your version number. This also tells you who compiled the kernel and what compiler they used.


What is the difference between the server installation and the client installation?

They have different sets of installed packages. Check the map.* files in installcd1/setdir and installcd2/setdir to learn precisely what packages are in which set. Roughly,

Server
Almost everything except the X windows GUI packages
Client
Everything
HomeNet
Server, with special setup to be a masquerading gateway firewall router for a fake class C address range 192.168.0.X with up to 254 hosts.
HomeNet
Server, with special setup to be a masquerading gateway firewall router for a fake class B address range 172.16.X.X with support for thousands of hosts.

Why not use LinuxTLE?

The LinuxTLE distribution is a popular RPM-based distribution localized for Thai support. If you like RPM-based Linux distributions like Red Hat and you do not care about trying to build the packages yourself, or you need Thai language support in X windows, then LinuxTLE may be the right choice for you.


Why is OpenLDAP not working with PHP?

According to Patcharin Kosonpothisakun, one change is required to get this working. It is:

    In file slapd.conf, add the command "allow bind_v2" to allow
    LDAP_V2.

How can I setup mysql replication?

Please see the step-by-step guide to mysql replication.


Why does my neworking hang?

I am getting mysterious hangs on my internet connections. If there is a burst of screen output the application hangs forever.

This is almost certainly a problem with your MTU. A lot of low-budget equipment and dialup stuff cannot really do an MTU of 1500 which is our default and the default of ethernet. You can adjust this at runtime like this:

ip link set eth0 mtu 576

You can adjust it permanently in the etc/rc.d/rc.netmaster script where you see MTU. 576 is the number to try and if it works you can try larger numbers if you are an optimist.

Debugging this is painful because often it is an intermittent problem. All it takes is one router between you and the destination to have a bad mtu, and if you have "don't fragment" packets you lose; also some firewalls cannot handle fragments; when somebody between you and the destination reboots, the problem no longer occurs.


How do I print to my laserjet that uses an HP JetDirect card?

Use the blsprintconfig to configure your printing. You can do man blsprintconfig to learn more. After completing the configuration, you can print a text file or a Postscript file using the lpr command like this:

lpr somefile

How can I make the 'su' command work?

Our enhanced security in BLS requires that in order to successfully use the su command you must either be root or a member of the wheel group. As root, you can add a user joe to the wheel group like this:

usermod -a -G wheel joe

The user joe needs to log out and then log back in to have the change take effect.


How can I use files greater than 32MB?

Our enhanced security in BLS puts limits on the resources a non-root user can allocate. The file which controls this is /etc/security/limits.conf and is only editable by the root user. To allow a user joe to have no filesize limit, you would add a line like this:

# for hacker
joe              hard    fsize           unlimited

You need to add line just before the comment line that says this:

# default values for normal users

This is controlled by PAM. The documentation for PAM is in /usr/doc/linux_pam*/html and you can access it like this:

lynx file:///usr/doc/linux_pam-0.80/html/index.html

Start with the link to System Administrator's Guide to begin the process of learning about PAM. The user joe needs to log out and then log back in to have the change take effect.


How can I setup remote system logging?

Please see the instructions for remote logging with rsyslog.


How can I check if OpenLDAP is working?

Patcharin Kosonpothisakun said this in response to the question:

I use this command to test "Is ldap working with SSL?"

ldapwhoami -x -H ldaps://192.168.0.1 -D "cn=Manager,dc=blsldap,dc=sci,dc=buu,dc=ac,dc=th" -W

I use this command to test "Is ldap working without SSL?"

ldapwhoami -x -h 192.168.0.1 -D "cn=Manager,dc=blsldap,dc=sci,dc=buu,dc=ac,dc=th" -W

You need to change the IP to be the IP of the OpenLDAP server.

Patcharin

How can I use Mysql with PHP?

As root, edit the file /etc/php/php.ini and find the section for Mysql. It will start something like this:

[MySQL]
; Uncomment this to load the mysql module
;extension=mysql.so

; Allow or prevent persistent links.
mysql.allow_persistent = On

; Maximum number of persistent links.  -1 means no limit.
mysql.max_persistent = -1

Remove the semicolon (;) from the line about mysql.so, then restart your web server. If you are running the default lighttpd web server, then you would do this:

/etc/rc.d/rc.lighttpd restart

How can I control volume on my CMI9739 sound chip?

If you are unfortunate, you may have a PC with a bad CMI9739 sound chip. Many intel boards have these awful chips. Do this:

cat /proc/asound/cards

If you see something like this:

0 [ICH5            ]: ICH4 - Intel ICH5
                      Intel ICH5 with CMI9739 at 0xf8001000, irq 10

then you have the bad sound card. You will notice that you cannot set the volume with alsamixer and the volume controls in xine do not work. The important part here is the 'CMI9379'. You have two options:

  1. The best choice for the affluent
    1. disable the sound in the BIOS
    2. insert a real sound card (see http://alsa-project.org/ to learn what cards are well supported)
    3. enjoy the wonderful sound
  2. Make the awful CMI9739 work despite it's substandard engineering. The rest of this document describes how to do this. If you have money, though, skip it and buy a good sound card instead.

Oh no, you are still reading this? That means you are poor and have the piece of detritus known as the CMI9739 that masquerades as a modern sound card. I pity you. Here follows a guide showing what has to be done....

You need to create a file ${HOME}/.asoundrc with these contents:

pcm.!default {
    type plug
    slave.pcm {
        type softvol
        slave.pcm "hw:0,0"
        control {
             card 0
             name "PCM Playback Volume"
        }
    }
}

This will tell ALSA to use software sound control (the CMI9739 has no hardware volume register) and finally you will be able to control your sound volume level.

For xine, you would do this:

  1. rm -fr ${HOME}/.xine
  2. start xine
  3. click the ok button on the initial configuration dialog window
  4. close xine (click on upper righthand corner of window with the random graphics)

Now the next time you start xine, it will work.


How can I setup user/group quotas?

Please see the instructions for setting up quotas.


Why should I use BLS?

If you are not sure what distribution to use, then BLS is probably not for you. With BLS you get support from Mr. Ham, including a moderate level of customization of the distribution to meet your needs.


Help! I cannot ssh to my BLS server!

By default nobody can log in remotely to your machine to enhance security, even when the sshd daemon is running. For a user to be permitted the remote login privilege, they must be a member of the canlogin group. To add user xyzzy to the canlogin group, you would do this as root (do not enter the leading '#'; that is the command prompt):

#usermod -a -G canlogin xyzzy

After the user is added to the group, they can login with ssh if you have activated the ssh daemon with servsetup. The root user cannot log in remotely ever; log in as a normal user and use the su command.


I want GNOME

Many people request GNOME. GNOME is extremely hard to build because it depends on compiling literally hundreds of libraries with particular options in a particular order to work. The garnome system is the only way to build it officially, and that takes days, has many crashes, and when you finish you have to use 3 CD-ROMS for the binary results, since it duplicates just about every library on your system. So it is hard to build, buggy, huge, and impossible to support. If you must have GNOME, try the Ubuntu linux distribution. Servers do not need GNOME. For client mode, we provide XFCE.


I want KDE

I used to build KDE for BLS, but nobody used it. It has bad screen saver crashes, the audio system does not work with xine, and the help indexer (htdig) is abandonware and doesn't work. Unlike GNOME, a mere mortal can build KDE, but like GNOME it is frightfully unstable and buggy. Servers do not need KDE. For client mode, we provide XFCE.


I want laptop support

Today BLS is known to run reasonably well on Acer Aspire 4720 laptops, but the built-in camera does not work. The wireless networking works for dynamic IP in a network that does not use encryption. The bluetooth may work, but I have no gear for testing so I don't know. The intel 965GM graphics work well, and DRI works. The DVD burner works. The USB ports work.


How can I add all the users to 'canlogin' group?

If you upgraded an existing system and you have many users, you need to add all of the users you want to be able to ssh into the machine to the canlogin group. Some people think this is difficult. Actualy, it is easy, just use this script:

#! /sbin/bash
exec 3< /etc/passwd
while read -u 3 ALINE
do
  # get username
  username=${ALINE%%:*}
  ALINE=${ALINE#*:}
  # skip unused password field
  ALINE=${ALINE#*:}
  # get user id
  userid=${ALINE%%:*}
  ((userid<1000)) && continue
  ALINE=${ALINE#*:}
  # skip groupid
  ALINE=${ALINE#*:}
  # skip username field
  ALINE=${ALINE#*:}
  # get home directory
  userhome=${ALINE%%:*}
  [[ "${userhome}" == "/" ]] && continue
  [[ "${userhome}" == "/dev/null" ]] && continue
  [ ! -d "${userhome}" ] && continue
  ALINE=${ALINE#*:}
  # get shell
  usershell=${ALINE%%:*}
  ((${#usershell}<1)) && continue
  [[ "${usershell}" == "/" ]] && continue
  [[ "${usershell}" == "/bin/false" ]] && continue
  ! grep -q "^${usershell}$" /etc/shells && continue
  # if we get here then the user has a uid > 1000, they have a
  # reasonable home directory, the shell is ok, etc.
  NOWGROUPS=$(groups ${username})
  ADDIT=1
  for group in ${NOWGROUPS}
  do
    [[ "${group}" == "canlogin" ]] && ADDIT=0 && break
  done
  ((ADDIT>0)) && printf "usermod -a -G canlogin %s\n" "${username}"
done
exec 3<&-
exit 0

How can I add new users and groups?

Please see the instructions for managing users and groups.


How can I backup my system?

Please see the instructions for making backups.


How can I schedule tasks to be run later or periodically?

Please see the instructions for running batch jobs.


How can I upgrade my BLS software?

Please see the instructions for upgrading BLS.


How can I setup anonymous FTP service?

Please see the instructions for setting up anonymous FTP service on BLS.


How can I setup normal WWW service?

Please see the instructions for setting up WWW service on BLS.


How can I support user ${HOME}/public_html web pages?

Please see the instructions for setting up user directory (public_html) WWW service on BLS.


How can I setup anonymous rsync service?

Please see the instructions for setting up anonymous rsync service on BLS.


How can I use apache instead of lighttpd?

The apache web server is not supported on BLS. If you insist on using it, you must provide your own support. We do not support apache since it will not obey resource and connection limits properly, and tends to consume all resources and crash the machine under load.


How can I stream ogg audio?

Please see the instructions for running your icecast ogg stream.


How can add a desktop icon for an application in xfce4?

This is best explained by example. Here are the step-by-step instructions for adding a calculator to the desktop in XFCE4. You will need to know the full path to your application executable.

  1. right-click on HOME icon
  2. Desktop->Create Launcher
  3. Put calculator in Name box
  4. Put /usr/X11R7/bin/xcalc in Command box
  5. left-click 'No icon'
  6. left-click 'gnome-calculator'
  7. left-click OK button
  8. left-click Create button

How can add a menu item for an application in xfce4?

This is best explained by example. Here are the step-by-step instructions for adding a calculator to the menu system in XFCE4. You will need to know the full path to your application executable.

  1. Click on blue X with black mouse in the panel to bring up menu
  2. Choose settings->menu editor
  3. right-click on xterm
  4. choose add entry
  5. Put 'Calculator' into Name box
  6. Put /usr/X11R7/bin/xcalc into Command box
  7. left-click on 'No Icon' button
  8. left-click on 'gnome-calculator' icon
  9. left-click on OK
  10. left-click on OK
  11. Choose menu File->Quit
  12. left-click save button in pop-up dialog

How can I add a panel item for an application in xfce4?

This is best explained by example. Here are the step-by-step instructions for adding a calculator to the panel system in XFCE4. You will need to know the full path to your application executable.

  1. Right-click on any icon in the panel
  2. Left-click on 'add new item'
  3. Left-double-click on 'Launcher'
  4. Put /usr/X11R7/bin/xcalc into Command box
  5. If you have a custom icon, you can put the full name to it (with PATH) it in the box that has the icon in front of it. Most icons are in the /usr/share/icons tree somewhere. If you want a custom icon, try looking here: http://commons.wikimedia.org/wiki/Category:Crystal_64
  6. Replace the text in the Name box with 'xcalc'. This shows up in the tooltip when your mouse hoovers over the icon in the panel.
  7. Replace the text in the Description box with 'desktop calculator'.
  8. Click the 'Close' button when you are done.

How can I add a second hard disk for storage

This is best explained by example. Here are the step-by-step instructions for adding a second hard disk for storage. In this example we are on a system with libata-based disks (/dev/sd[abcd]). Some older systems use /dev/hd[abcd] instead.

  1. Install hard disk correctly. For IDE you have to set jumper to make second hard disk on the cable be slave and the first hard to disk to be master, or on higher-end machines set them both to be cable select. As your local alpha-geek for help if you don't know how to do this. For SATA there is only one disk per cable, but you have to be careful that your boot disk remains the boot disk. For SCSI you have to have proper jumper settings so all drives have different ID values (and all are different than your controller) and the cable must be properly terminated.
  2. Boot linux, use dmesg and sfdisk to verify the kernel sees the drive. I will assume the new drive is /dev/sdb in this example.
  3. pvcreate /dev/sdb
    This will create a physical volume that spans the entire new disk. The disk is not partitioned.
  4. vgcreate datavg /dev/sdb
    This will create a volume group called datavg using the storage in the /dev/sdb physical volume. In other words, the datavg is a volume group that spans all of the second hard drive.
  5. lvcreate -l +50%FREE -n datalv datavg
    This will create a logical volume called datalv in the datavg volume group. It will use half of the second hard disk, leaving the rest as spare space for expansion later, or possibly for creating other logical volumes. If you want to use it all now, say 100 instead of 50 percent.
  6. mke2fs -c -c -L datalv -b 4096 -i 4096 -j -m 3 /dev/datavg/datalv
    This will create an ext3 filesystem inside the datalv logical volume. For a large disk, this can take a long time. Start it up before you sleep, and when you wake up it should be done. This will check the hard disk for bad blocks for you - you need to do this for any new disk.
  7. mkdir /data
    This creates the mountpoint for the filesystem in the datalv logical volume.
  8. echo '/dev/datavg/datalv /data ext3 defaults 1 2' >>/etc/fstab
    The spaces you see are actually tabs (created with the tab key). This adds your new filesystem to the system filesystem list so when you reboot the filesystem will be automatically mounted.
  9. mount /data
    This will mount the new filesystem on the /data mountpoint so you can use it. Since you added this to the /etc/fstab file, in the future the system will automatically mount this filesystem when you boot the computer.

How can I add a second hard disk for more /home?

This is best explained by example. Here are the step-by-step instructions for adding a second hard disk for storage. In this example we are on a system with libata-based disks (/dev/sd[abcd]). Some older systems use /dev/hd[abcd] instead.

You can grow any logical volume, such as /usr, /opt, /var, and /tmp using the same technique.

  1. Install hard disk correctly. For IDE you have to set jumper to make second hard disk on the cable be slave and the first hard to disk to be master, or on higher-end machines set them both to be cable select. As your local alpha-geek for help if you don't know how to do this. For SATA there is only one disk per cable, but you have to be careful that your boot disk remains the boot disk. For SCSI you have to have proper jumper settings so all drives have different ID values (and all are different than your controller) and the cable must be properly terminated.
  2. Boot linux, use dmesg and sfdisk to verify the kernel sees the drive. I will assume the new drive is /dev/sdb in this example.
  3. pvcreate /dev/sdb
    This will create a physical volume that spans the entire new disk. The disk is not partitioned.
  4. vgextend blsvg /dev/sdb
    This will add the storage in the /dev/sdb physical volume to the existing blsvg volume group.
  5. lvextend -l +50%FREE /dev/blsvg/home
    This will add half of the second disk storage to your /home logical volume, saving the rest for later. If you want to use it all now, say 100 instead of 50 percent.
  6. resize2fs -p /dev/blsvg/home
    This will grow the /home filesystem to fit the newly enlarged size of the /dev/blsvg/home logical volume. This is on-line resizing.

How can I use my Solomon air card?

This was tested with a Solomon SEGM-520 Edge air card that connects to a USB port. It might work with other hardware but then again it might not. I have no way of knowing.

On a BLS 1.1.004 system, you will need to upgrade to kernelpack 2.6.26.2 or newer, and netmaster-3.0-noarch-60 or newer. You also will need to add the ppp, wvstreams, and wvdial packages. After all of this reboot so your new kernel will be running. Then if you use DTAC, do this as root in runlevel 3 (if you used GUI login, you need to init 3 from an xterm as the root user first):

cp /usr/doc/wvdial-*/wvdial.conf.SEGM-520_SOLOMON.DTAC /etc/wvdial.conf
wvdial

You only need to copy in the wvdial.conf once; later you just use wvdial.

It may take a few tries to get connected; the wvdial tool will take care of all the retries for you. After connection it may take about a minute for the networking to adjust itself to the new DNS name server and get the firewall activated. After that, you can change VTs using alt-FX (FX is F1, F2, etc.) until you get an unused VT. Now log in as a normal user and work. When you are ready to break the connection, log out of that user and use alt-FX to return to the VT that wvdial is in. Press ctl-C to stop wvdial. It will take about a minute for networking to return to normal.

If you are not using DTAC, good luck. Adjust the /etc/wvdial.conf to match your user, password, and telephone number.


How can I use software RAID5?

If you have 3 non-boot hard drives on your system, you can setup a software RAID5 array. This allows the system to recover from errors if one of the hard disks fails. If you have a fourth drive you can even have a hot spare drive. RAID5 is explained many places on the internet; use your favorite seach tool to learn more about the concept.

Let us assume your system has 4 non-boot drives, /dev/sd[bcde], that you will use for software RAID5. These drives ideally will be identical models purchased at the same time. Here are the commands to setup your RAID array:

modprobe raid456
mdadm --create /dev/md0 --level=5 --raid-devices=3 --spare-devices=1 /dev/sd[bcde]
dd if=/dev/zero of=/dev/md0 bs=512 count=1
pvcreate /dev/md0
vgcreate archive /dev/md0
lvcreate -l 100%FREE -n archivelv archive
chmod 0755 /data
mke2fs -b 4096 -i 4096 -j -m 3 -c -c /dev/archive/archivelv
mount -t ext3 -o rw /dev/archive/archivelv /data
echo '/dev/mapper/archive-archivelv /data ext3 defaults,noauto 1 3' >>/etc/fstab

For a large array, the format (mke2fs) can take hours - start this up when you go to sleep, and it should be done when you wake up the next morning.

Probably you want to have the system automatically mount this drive every time you boot the machine. You can do this easily using /etc/rc.d/rc.local by adding some lines to the local_start() and local_start() functions. Add this to your local_start() just after the line that says '# add your stuff after this line'

  if ! grep -q '[[:space:]]\+/data[[:space:]]\+' /proc/mounts
  then
    # assemble raid data area
    modprobe raid456
    mdadm --assemble /dev/md0 /dev/sd[bcde]
    vgchange --ignorelockingfailure -ay archive
    mount -t ext3 -o rw /dev/mapper/archive-archivelv /data
  fi

In your local_stop() you need to add these lines immediately after the line that says '# add your stuff after this line in reverse order of local_start':

  if grep -q '[[:space:]]\+/data[[:space:]]\+' /proc/mounts
  then
    if ! umount /data
    then
      # show the bad people
      fuser -mv /data
      # and kill them
      fuser -km /data -HUP
      sleep 2
      # and nuke them
      fuser -km /data
      # and try umount again
      if ! umount /data
      then
        printf "Man you are doomed - I cannot umount /data"
        return 1
      fi
    fi
  fi
  if vgs --noheadings -o vg_name | grep -q " archive"
  then
    vgchange --ignorelockingfailure -an archive
  fi
  if [ -e /proc/mdstat ]
  then
    mdadm --stop /dev/md0
  fi
  if grep -q '^raid456[[:space:]]\+' /proc/modules
  then
    modprobe -r raid456
  fi

After the array is working, you can learn more about it with this command:

mdadm --detail /dev/md0

How can I stop getting the Fail2Ban email as root in my inbox?

You can have procmail automatically file them in their own folder. Log in as root and do this:

cat >/root/.procmailrc <<"EOF"
SHELL=/bin/sh
FORMAIL=/usr/bin/formail
SENDMAIL=/usr/bin/sendmail
PATH=/usr/bin:/bin
DEFAULT=/var/spool/mail/${LOGNAME}
MAILDIR=${HOME}/mail
LOGFILE=${HOME}/.procmail.log
LINEBUF=8096
VERBOSE=on

:0
* ^Subject: \[Fail2Ban\] SSH: (banned|stopped|started)
* ^From: Fail2Ban
${MAILDIR}/Fail2Ban
EOF
chmod 0600 /root/.procmailrc

How can I set my firefox to default Thai mode?

  1. start firefox
  2. On the menu, help->About Bon Echo
    If it does not say 2.0.0.17, then get version 2.0.0.17
    click OK button to close the popup version window
  3. click on URL box
  4. type
    about:config
    and press enter
  5. In the Filter box type
    lang
    and press enter
  6. double-click on line that says
    intl.accept_languages
  7. change value to be
    th,en-us,en
    and press ok button
  8. Edit->preferences
  9. Click blue globe (Content)
  10. Click Advanced button in "Fonts & Colors" section
  11. Change "Default Character Encoding" to UTF-8
  12. Click on "Western" and change to "Thai" at "Fonts for:" label
  13. Choose Thai fonts for Serif, Sans-serif, and Monospace (Garuda, Sawsdee, TlwgMon for instance)
  14. Change Size next to monospace to be 16
  15. Click OK button
  16. Click Close button

How can I curl-loader for simple testing?

First, download curler.sh, then do this as the root user:

chmod 0700 curler.sh
./curler.sh

You can learn more at the curl-loader web site here: http://curl-loader.sourceforge.net/


How can I password protect a directory when I use lighttpd?

The lighttpd web server does not support the .htaccess files some people are familiar with. You can still easily password protect a directory, however. We will use digest authentication. First append the following to the end of your /etc/lighttpd.conf file:

auth.debug = 1
auth.backend = "htdigest"
#
# create user/password entries like this:
#    htdigest 'john' 'Party Zone' 'password' >>/etc/lighttpd_htdigest.user
# Note: the 'Party Zone' must match the "realm" entry below...
#
auth.backend.htdigest.userfile = "/etc/lighttpd_htdigest.user"
auth.require = ( "/party/" =>
                 (
                   "method"  => "digest",
                   "realm"   => "Party Zone",
                   "require" => "valid-user"
                 )
               )

Now change the /party/ to be the relative path to the directory you want to protect. For instance, if you want to protect the directory /var/www/htdocs/download/special/, you would use /download/special. The realm allows you to have separate security sets for different areas. This means that user 'john' in 'Party Zone' is not the same as user 'john' in 'Work Zone', for instance, and those two john users can have different passwords. Anyway, after you change the /etc/lightttpd.conf file, you need to restart the web server like this:

/etc/rc.d/rc.lighttpd restart

Now you need to create some user/realm/password entries, one for each user/realm that you plan to use. You do this like this:

htdigest 'john' 'Party Zone' 'password' >>/etc/lighttpd_htdigest.user

How can I add/remove/change PCI LAN cards?

When you decide to add, remove, or change a PCI LAN card, you need to delete the old udev configuration which contains the MAC address. To do this you just do this (as root) BEFORE you shutdown the machine to make the hardware change:

rm -f /etc/udev/rules.d/70-persistent-net.rules

That file will be regenerated by udev during the bootup next time, and then it will have the correct MAC addresses. You will need to run the netmaster utility to reconfigure your system. If your system is configured as an 'Authentication Gateway' system then you must contact BLS technical support to reconfigure your sytem.


How can I use nc6 to check a web server?

This is tricky, since you have to have MS-DOS line endings for the HTTP/1.1 protocol. MS-DOS line endings are 0D 0A (hexadecimal). Here is how you can do it:

printf "GET / HTTP/1.1\r\nHost: localhost\r\nConnection: close\r\n\r\n" | nc6 -4 -v 127.0.0.1 80

Of course you can use shell redirection to capture the output. This gives you a way to get the raw response from the web server including all headers, even if you cannot run firefox with LiveHTTPHeaders (maybe you are a server without Xorg, for instance). The Host: header is required for HTTP/1.1 to work.

If you want to test the older HTTP/1.0 protocol, you can do this:

printf "GET / HTTP/1.0\r\n\r\n"  | nc6 -4 -v 127.0.0.1 80

NOTE: Some web servers will let you get by without the special MS-DOS line endings, but all will accept them. For instance, apache seems to break the protocol and accept a request that does not have the required carriage returns, but lighttpd will not respond to the incorrect protocol since that would break the compliance to the HTTP/1.1 standard.

In all of these commands, change 127.0.0.1 to the IP of the server you want to test. Change the port 80 to the port you want to test, if the server is using a non-standard port (like 8080). For the HTTP/1.1 protocol, change localhost to the hostname on the server you are trying to reach.


Last modified: Fri Feb 5 21:53:15 ICT 2010 Copyright (C) 2005-2010 by John Gatewood Ham