configure NSD as slave for BIND

To configure name server deamon as slave for bind:

# useradd -c “NSD” -d /home/nsd -s /sbin/nologin -u 1005 nsd

Download and install the latest version of nsd

# ./configure –prefix=/home/nsd –enable-dnssec –enable-tsig –with-user=nsd
# make
# make install

Edit config: /home/nsd/etc/nsd/nsd.conf
hide-version: yes
debug-mode: no
ip4-only: no
ip6-only: no
database: "/home/nsd/var/db/nsd/nsd.db"
identity: ""
logfile: "/var/log/nsd.log"
server-count: 1
tcp-count: 10
pidfile: "/home/nsd/var/db/nsd/"
port: 53
statistics: 3600
chroot: "/home/nsd/etc/nsd"
username: nsd
zonesdir: "/home/nsd/etc/nsd"
difffile: "/home/nsd/var/db/nsd/ixfr.db"
xfrdfile: "/home/nsd/var/db/nsd/xfrd.state"
xfrd-reload-timeout: 10

Add key and zone file details:

Start NSD with:
/home/nsd/sbin/nsdc start

to create zone files:
/home/nsd/sbin/nsdc patch



Changing subversion (svn) url

To change the svn url:

$ svn switch –relocate file:///tmp/repos file:///tmp/newlocation .
or if it is with ssh
$ svn switch –relocate svn+ssh://username@svnurl/path/to/svn/ svn+ssh://new_username@new_svnurl/path/to/svn/


resetting mac os x password

To reset the password on MAC OS X,
– hold down apple+s key while booting the machine, this will take you to the single user mode
– Mount the file system using , # mount -uw /
– Enter the passwd command with username , #passwd
– reboot the machine

Anyway this will not reset the key chain password, to reset the key chain password:
1. Open Keychain Access, which is in the Utilities folder within the Applications folder.
2. From the Keychain Access menu, choose Preferences.
3. Click Reset My Keychain, which is under the General pane.
4. Authenticate with your account login password.
5. Quit Keychain Access.
6. Restart your computer.
ref :


Linux mail

auto responder with postfix/virtual

To configure autoreponder for some address with postfix.

Edit the postfix virtual configuration:
Add –
email_address recepient_lists,

Edit the transport configuration:
Add – autoreply:
eg: autoreply:

Create pipe for the transponder in

autoreply unix – n n – – pipe
flags= user=nobody argv=/usr/local/bin/autoreply $sender $recipient

Created autoreply script at /usr/local/bin/autoreply

/usr/sbin/sendmail -oi -t << EOF From: To: $1 Subject: Auto Response from Content-Type: text/plain; charset=utf-8 This is an autoreponder email. EOF

There is other better way to do it with procmail and other tools, depends on your mail server setup

Linux mail

Add SPF for validation to mail server

It is good to have spf implemented to make the recepient mail servers trust your entity.

Use the spf wizard to generate the record and add it in your dns zone file.


apache Linux php

get rid of apache@localhost in received email headers

There is a good change that the foreign email servers will drop if the sender email headers are not properly formatted.
Anyway if you get apache@localhost in Received header (with postfix/apache/php), you can change the php.ini, sendmail_path program to use sendmail.postfix instead of sendmail binary.

like : sendmail_path = /usr/sbin/sendmail.postfix -t -i -f


fax Linux

Hylafax/FaxMail with unicode encoding

It is pretty hard to get unicode works with fax ..
here are some scripts that i used to get the unicode done for incoming html/text faxes.

vi /etc/hylafax/faxmail/text/html
cp -pf $1 /tmp/email.html
/usr/bin/lynx -dump -display_charset=utf-8 /tmp/email.html > /tmp/html_txt
/usr/bin/uniprint -font /etc/hylafax/faxmail/Cyberbit.ttf -in /tmp/html_txt -out /tmp/html_txt.uni
cat /tmp/html_txt.uni|/etc/hylafax/faxmail/
rm /tmp/email.html
rm /tmp/html_txt
rm /tmp/html_txt.uni

plain text

vi /etc/hylafax/faxmail/text/plain
/usr/bin/uniprint -font /etc/hylafax/faxmail/Cyberbit.ttf -in $1 -out /tmp/plain_txt
# echo " "
# echo "showpage"
cat /tmp/plain_txt | /etc/hylafax/faxmail/
$rm /tmp/plain_txt
# Read from the standard input
# Count the number of "showpage"
for($i=0;$i<=$size;$i++){if($text[$i] =~ /showpage/){$count++;}}
# Discard the last line that contain "showpage"
if($text[$i] =~ /showpage/){
print $text[$i];

Linux mail

Cleanup mailman held messages

It will work usually with
$ cd /usr/lib/mailman
$ bin/discard /var/lib/mailman/data/heldmsg--*

If the list is too long
$ cd /var/lib/mailman
$ find data -name heldmsg--\* -print | xargs /usr/bin/discard