Tuesday, October 31, 2006

The Game of the Century

apart from being a big daddy, a good & responsible hubby, a cool unix/linux guy etc bla bla bla yada yada yada... i've one thing that i'm addicted with, which is playing chess!!! i can spend the whole night/day playing chess on yahoo! games.
i share this same hobby with my wife. so anybody out there wanna play with me, just look for me on yahoo! chess. normally if i'm online, i'm playing chess. but make sure your point 1500 and above hehehe and by the way my yahoo! id is ashamrill

below is the game of the century played by bobby fischer. he was only 13-year-old on that time - 1956
black turns, guess what is the next move by him?
you can replay the moves here:
http://chessbase.com/news/2006/games/fischer1956.htm - what a brilliant move!

The game that shook the world:

Monday, October 23, 2006

my hero's birthday

His 5th birthday today.
he asked for remote control car for his birthday present & we bought him one.
happy birthday Abang! We love you so much!

Thursday, October 19, 2006

quick updates!

been long time not updating my blog. quite busy with something...

some updates:
bloggers idol - guess what? my wife is the winner of the bloggers idols 2006.
congratulation mummy! you deserved it. proud of u muahhhhhhh :*

did some wiring for my house alarm system with my brother in law. fyi, my house been broke in recently. dang!!! tak leh harap security guard dah!

and of cos for raya celebration, busy make up + painting my house... till now still haven't finish yet. question: purple matching ngan color apa ek?

in the other hand, i'm celebrating my birthday today. happy birthday to me! thanks for the gifts yang!

lastly, i would like to wish to those who celebrating...
selamat hari raya & maaf zahir batin. berhati2 di hari/jalan raya :)

p/s: reminder for myself! pi bayar zakat fitrah.

Wednesday, October 04, 2006

Malaysian Bloggers Idol 2006 - FINAL!!!

Thanks to your votes, my wife now in the final of Malaysian Bloggers Idol 2006. This week is the final one. (thanks god! kalo dak asik kesepian aku!)

This is her final assignment - Malaysia has had the facilities to process nuclear waste for the last 30 years (in Perak), with the increase in oil prices, should Malaysia look into having it's own Nuclear power plant?

As usual, please vote for her. Voting starts at 12.00noon this Thursday until 12:00noon Sunday. Thanks!

Good luck Mummy!

Tuesday, September 26, 2006

FAQ during interview for UNIX/LINUX system engineer/admin

I'm compiling a never_ending_list of questions that frequently asked during interview session for UNIX/LINUX system engineer/admin post. No, I'm not looking for new job right now or preparing for an interview, just want to make a list and share my experience. hopefully it could help others for their interview. even though you do all these tasks almost everyday, sometimes all the sudden your brain went blank during the session... dang!!! so be prepared!
you are most welcome to add yours in the comment!

here are the questions i've been asked, those that i can remember.
in no specific order:

1. Explain suid, sgid & sticky bit
2. What is sudo?
3. When you create a file in unix, by default what permissions will be applied to it? How do you change this setup?
4. Journaling filesystem? What is it?
5. What is /proc?
6. Explain steps to add new hard disks untill to mirror them
7. NFS export options/features/security
8. Autofs - Is it possible to mount the directory without cd into it?
9. What is stale file handle error in NFS?
10. What is the difference between UDP and TCP?
11. How do you list open files?
12. How to check number of files limit by kernel?
13. What is the difference between hard and soft mount?
14. Explain boot process
15. What is PAM?
16. What performance monitoring tools do you use?
17. Explain load average
18. What is ssh? How to setup trust between accounts/machines?
19. NIS administration/commands
20. How to limit certain users accessing certain machines?
21. How you troubleshoot slow performance?
22. Jumpstart & kickstart servers & process
23. Package management for linux & solaris - how to use them?
24. Solaris mirroring
25. What is zombie process?
26. Scripting skills, to automate certain jobs, cron
27. How do you perform changes on a few machines?
28. Xwindows options/features/security

looking for the answers? No... you have to find the answers yourself :P

Thursday, September 21, 2006

Help my wife to be final 3 in Bloggers Idol 2006

All you need to do is to vote for her at http://bloggers-idol.blogdrive.com/ - Click on Red Mummy & Vote!

Voting starts at 12.00noon every Thursday until 12:00noon Sunday. Anybody can vote but limited to one time per day due to the poll will check your IP Address!

This is her 8th week assignment.
Thanks for your vote!

zero the log files

what the different between these 2 commands?
# cat /dev/null > /var/log/messages

# > /var/log/messages
both commands zero the /var/log/messages file
but using > will not spawn a new process.
so you'll need to restart syslogd. (only on solaris but not on linux)

Saturday, September 09, 2006

my girl's birthday

She turns 2 today. This picture was taken on her 1st birthday. We had her birthday party at A&W PJ. This year, family celebration only... (read: bajet kurang heehehehe)
Don't look like me eh? Memang pun! everytime when I took her jalan2 especially only 2 of us, people always asked "eh your daughter aa" cam tak caya jer anak aku!!!

Her mummy has the details on how she has been borned, snap into here

Happy birthday gegirl! We love you so much!

Saturday, August 26, 2006

Happy Birthday Linux

15 years ago...
From: Linus Benedict Torvalds
Date: Mon, Aug 26 1991 4:57 am
Email: torva...@klaava.Helsinki.FI (Linus Benedict Torvalds)
Groups: comp.os.minix

Hello everybody out there using minix -

I'm doing a (free) operating system (just a hobby, won't be big and professional like gnu) for 386(486) AT clones. This has been brewing since april, and is starting to get ready. I'd like any feedback on things people like/dislike in minix, as my OS resembles it somewhat (same physical layout of the file-system (due to practical reasons) among other things).......

me with Linus - LinuxWorld 2003 San Francisco

Happy Birthday Linux!

Thursday, August 17, 2006

Vote for Red Mummy in Bloggers Idol 2006 (3rd Week)

You’ve heard of Malaysian Idol and American Idol and now on the Malaysian Blogger scene, we’ve got Bloggers Idol 2006. Participants will be given an assignment every week and are required to complete the assignment & post it on their blogs. Then the voting starts and the one with the lowest votes will be eliminated. Vote start at 12.00pm every Thursday until 12:00pm Sunday. Anybody can vote but limited to one time per day due to the poll will check your IP Address!

I just happen to know this not_kind_of_me_things because one of the participants is my lovely wife and this is her 3rd week assignment -

Can a man love two women at the same time?
And vice versa; Can a women love two man at same time?

Please vote for her at http://bloggers-idol.blogdrive.com/ - Click on Red Mummy & Vote!
Thanks for your vote.

p/s: miss u... 2 days to go ;)

Tuesday, August 08, 2006

mari ke miri (let's go to miri)

i'm away now for another business trip. this time to Miri, Sarawak for 2 weeks. gonna miss my family...hmmm actually already miss them :(

the best thing here is our hotel provide us free & unlimited internet access using their streamyx line. cool!
the second best thing is our office give us the new HP LP2465 Flat Panel Monitor instead of using our small laptop display :P

accessing solaris & linux from windows

i wish i have 1 at home!

still waiting for the 3rd, 4th, 5th & so on best things here hehehehe

but the not best thing is our office hour here start from 7am! have to wake up early lorrr...

Thursday, August 03, 2006

search engine for UNIX system administrators

today while browsing i found this site. quite useful :)

coolcommands.com is a search engine for UNIX system administrators. Our database provides access to useful commands for all flavours of UNIX including:

Sun Solaris IBM AIX HP/UX
SGI Irix Compaq Tru64 FreeBSD

coolcommands.com is NOT

coolcommands.com is not an online database of man pages but rather a query tool to find commands or one-line scripts which provide a function in a UNIX environment.

coolcommands.com is cool because

We not only provide a searchable database of commands and one-line scripts, we also allow you to search by category making it easier to find that command you are looking for. Each coolcommand provides a summary, description and example to make your life as a sysadmin easier.

give it a try!

Wednesday, August 02, 2006

ssh authorized_keys

just now, one user complained that he can't use his public key as an authentication to remote server.
he already generate the public key & did all the necessary steps but still the remote server asked for password after key in the public key.

i tried used my id and it worked just fine, so it could be something wrong with his id or his public key. try to regenerate his public key but still the same thing.
as you see from below verbose message of ssh, it still asked for password after key in the public key:
user1@local_server $ ssh -v remote_server
OpenSSH_3.8.1p1, OpenSSL 0.9.7a Feb 19 2003
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to remote_server [ip_address] port 22.
debug1: Connection established.
debug1: identity file /glb/home/user1/.ssh/identity type -1
debug1: identity file /glb/home/user1/.ssh/id_rsa type 1
debug1: identity file /glb/home/user1/.ssh/id_dsa type -1
debug1: Remote protocol version 1.99, remote software version OpenSSH_3.8.1p1
debug1: match: OpenSSH_3.8.1p1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_3.8.1p1
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-md5 none
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192)>
Enter passphrase for key '/glb/home/user1/.ssh/id_dsa':
debug1: read PEM private key done: type RSA
debug1: Authentications that can continue: publickey,gssapi-with-mic,password,hostbased
debug1: Next authentication method: password
user1@remote_server's password:
a friend of mine (trew) found the solution... thanks :)
it is actually because his home directory is group writable (775). for security reason, authorized_keys file cannot be writable by anyone else, this also apply to the parent directory of authorized_keys file, in this case - his home directory.
for more info refer to http://dsd.lbl.gov/~ksb/Scratch/ssh_user_setup.html at the authorized_keys section.

Friday, July 28, 2006

Happy SysAdmin Day!

Happy SysAdmin Day for me & all sys admin around the globe!
hopefully your users & servers will let you rest today :P

Today, Friday, July 28th, 2006, is the 7th annual System Administrator Appreciation Day. On this special international day, give your System Administrator something that shows that you truly appreciate their hard work and dedication.

Wednesday, July 19, 2006

random password generator

This is a very simple tool to generate a random password and almost available on all unixes.
$ cat /dev/urandom | strings -n 8 | head -5
Just pick one as your password :)

Monday, July 17, 2006

smart way to mount NFS file system

sometimes NFS mount point can hang when you do a listing (ls -al) due to certain reasons such as server down, network problems etcetera.

to avoid this is it advisable to make the mount point down one level of root.

instead of:
# mount NFS_server:/data /data
in this case, if the mount point hang,
# ls -al /
would take a long time until the NFS mount timed out.

you should do:
# mount NFS_server:/data /new_directory/data
so if the mount point hang, you can still do listing of root.
# ls -al /
would work fine just that
# ls -al /new_directory
would fail.

Tuesday, July 04, 2006

bash history - ignore duplicate & commands

put these lines in your .bash_profile to ignore duplicate history or to ignore certain commands.
and it also keep your history short :)
# ignore duplicate

# ignore these commands in history file

Friday, June 23, 2006

recover root password

previous post i mentioned about only hp-ux will ask old root password if you want to change the root password. in case you lost the root password, here is a list of a good compilation on how to recover the root password on various flavor of unixes:

how do I log into this machine - with a twist... (http://www.unix.com/showthread.php?s=&threadid=1927 )
Lost password on a SPARCstation Voyager (http://www.unix.com/showthread.php?s=&threadid=13702 )
How do I restore the etc/shadow file (http://www.unix.com/showthread.php?s=&threadid=3895 )
Root Password Lost !!! (http://www.unix.com/showthread.php?s=&threadid=9488 )
root locked out (http://www.unix.com/showthread.php?s=&threadid=2492)
sc password (http://www.unix.com/showthread.php?t=22079)

root pwd (http://www.unix.com/showthread.php?s=&threadid=13882)
lost root password using (SAM) trusted security (http://www.unix.com/showthread.php?s=&threadid=2084 )
I lost my password root (http://www.unix.com/showthread.php?s=&threadid=12466 )
passwd file corrupted (http://www.unix.com/showthread.php?t=17175)
Boot interaction ( http://www.unix.com/showthread.php?t=22534 )
Re-enabling a locked root account on Trusted HP-UX (http://www.unix.com/showthread.php?t=25319 )

root and all but 2 users locked out (http://www.unix.com/showthread.php?s=&threadid=12419 )
root password (http://www.unix.com/showthread.php?s=&threadid=5224)
how to retrieve root paswd ( http://www.unix.com/showthread.php?t=1844)
Help! passwd file corrupted (http://www.unix.com/showthread.php?t=18908)

root account has been locked (http://www.unix.com/showthread.php?s=&threadid=13658 )
Boot in Single-Mode (http://www.unix.com/showthread.php?t=18760)

How to Enable locked root account (http://www.unix.com/showthread.php?s=&threadid=8360 )

Fortgot root password SCO 5.0. (http://www.unix.com/showthread.php?t=20345)

I neede help!!! (http://www.unix.com/showthread.php?s=&threadid=3208)

NCR Unix
single user mode - user accounts passwords (http://www.unix.com/showthread.php?t=17435)

Beginners Guides: Forgotten Passwords & Recovery Methods (http://www.unix.com/showthread.php?s=&threadid=16216 )

source: http://www.unix.com/showthread.php?t=14327

ooops, they got for windows as well :)
i think on linux is the easiest one, so make sure you don't lost it :)
or maybe it time to use unix password manager

Tuesday, June 20, 2006

hp-ux change password

just now i tried to change one user password on hp-ux, but it prompt this instead:
# passwd user
Enter your user number here:

what the hell is this? never seen this before. i tried entered a few number but failed :(

but google helped me out :)
actually the system is in trusted mode. a user has been given admnum
check it with /usr/lbin/getprpw -m admnum user
# /usr/lbin/getprpw -m admnum user

provide the number while changing the password
# passwd user
Enter your user number here: 430
Last successful password change for user: NEVER
Last unsuccessful password change for user: Mon Jun 19 00:40:18 2006

New password:
Re-enter new password:

password changed succesfully!

Sunday, June 18, 2006

search engine for developers

this new search engine is dedicated to developers to search for a source code and
technical information.

cool eh, check it out http://www.krugle.com/

Wednesday, June 14, 2006

change root password

i just notice only hp-ux will ask old password if you want to change the root password
$ uname -a
HP-UX hostname B.11.00 U 9000/800 146901507 unlimited-user license
$ passwd
Changing password for root
Old password:

very good security practise i must say.
the rest, linux, solaris & aix, you can simply change the root password to new one without asking the old password.
# uname -a
Linux hostname 2.4.21-32.0.1.nfswan2 #1 SMP Thu Aug 4 11:02:01 CEST 2005 x86_64 x86_64 x86_64 GNU/Linux
# passwd
Changing password for user root.
Enter new UNIX password:

# uname -a
SunOS hostname 5.8 Generic_108528-13 sun4u sparc SUNW,Ultra-2
# passwd
passwd: Changing password for root
New password:

# uname -a
AIX hostname 1 5 0045C2CA4C00
# passwd
Changing password for "root"
root's New password:

Tuesday, June 13, 2006

unix/linux load average

do you know what it mean by load average when you execute these commands:
$ uptime
8:00pm up 238 day(s), 6:06, 39 users, load average: 0.60, 0.27, 0.26

$ w
8:01pm up 238 day(s), 6:07, 39 users, load average: 0.61, 0.30, 0.27

$ top
20:03:19 up 11 days, 5:23, 37 users, load average: 0.24, 0.14, 0.08

$ cat /proc/loadavg
0.12 0.09 0.09 1/253 532

from the man page, really i also not sure since it only says:
The uptime command prints the current time, the length of
time the system has been up, and the average number of jobs
in the run queue over the last 1, 5 and 15 minutes. It is,
essentially, the first line of a w(1) command.

but i've found these articles that nicely explained about this. read it here:

Saturday, June 10, 2006

vi / vim graphical cheat sheet

In an earlier entry, i mentioned about top 10 tips using vi, since it hard to remember it all, i used to have this vi graphical cheat sheet print out on my cubicle for quick reference.

today, while browsing the internet i found another useful & colorful vi/vim graphical cheat sheet. this is a single page describing the full vi/vim input model, the function of all keys, and all major features. you can see it as a compressed vi/vim manual. cool eh :)

source: http://www.viemu.com/vi-vim-cheat-sheet.gif

Friday, June 09, 2006

upgrade ssh server remotely

i've been looking for the most efficient way to upgrade ssh server remotely. this task is quite risky since if the upgrade not going as expected you'll lost your access to the box, unless you have console server connected to it, otherwise you'll need to ask somebody on site to log in locally & start the ssh daemon.

so far i've found several ways to do it:

1. install normal way
i found this useful article on how to upgrade ssh server remotely here
quite straight forward. just that you need to kill the ssh daemon manually & be careful not to kill your current session.

2. using at command
you can set specific time using at command to start the ssh daemon after you've installed it.
or something like:
# /etc/init.d/sshd stop; make install; /etc/init.d/sshd start
but i must say that this is quite risky since you are not sure whether the daemon can start up without any problem after the new installation.

3. use different port
some say you better use other port for the new ssh installation. if you can connect to the new ssh server using those port then you can revert it back to the normal port which is 22. low risk but extra steps.

4. enable the backdoor
enable the other remote access which is telnet. i think this is the most safest way to do it even though it is security risk to enable telnet but at least you can still access your box if the ssh kaput!

but how about you need to upgrade a ton of servers? which way you should go?
for me i'll go for no 4. write a script to do:
1) enable telnet & make sure you can access using telnet
2) install/upgrade ssh server & test the installation
with 1 condition, all your servers must have the same configuration. otherwise things gonna mess up pretty bad! good luck :)
or maybe i'll come up with the script later...

Saturday, June 03, 2006

script stdout | shell

when writing a shell script, it is important to make sure it does the correct things, especially when it come to execute the specific commands like rm etcetera. it is advisable to print out to stdout what the commands in the scripts do to make sure no typo/error made.
eg: script.sh
#! /bin/ksh
for file in *.log
echo rm $file

so when you run the script:
$ ./script.sh
rm 1.log
rm 2.log
rm 3.log

it will not execute the rm command since we only use echo. in order to execute it, no need to delete the echo but simpy pipe ( | ) it to the shell:
$ ./script.sh | sh

will delete those 3 log files.

Sunday, May 28, 2006

top 10 tips dealing with vi editor

as a unix/linux system admin, my main text editor is vi/vim, since it is available in most of the unixes. still remember when i first started using it, not really an easy job man! but now i'm quite comfortable with it and would like to share my top 10 tips when dealing with this editor, in no particular order:

1. undo & redo
don't be surprise that vi also have undo & redo capabilities. but for vi is only one level undo. not really sure how many level for vim, for sure more than vi. just press u to find out.
Esc + u or :u to undo
Ctrl + r to redo

2. search pattern
a few ways to search a pattern in vi:
/pattern search down for pattern
?pattern search up for pattern
pressing n or N to go to the next or previous matching pattern

press * or # search for a pattern under the cursor
pressing * or # to go to the next or previous matching pattern

3. search & replace
search & replace is quite important in my job where sometime i need to do a bulk replacement
:s/pattern/new_patten/ replace a pattern with new pattern
:1,$ s/pattern/new_patten/g g for replace all occurrences of pattern
:1,$ s/pattern/new_patten/c c for confirm replace

1 start from line 1
$ end at last line

4. go to specific line
do you hate when you run a scripts, an error occurred in specific line!
this is how you go directly to the line to find out what went wrong
:n will go to line n (eg: :69 will bring your cursor to line 69)
:se nu or :set number will display line number
:.= shows current line number
:= shows number of line in file
Ctrl + g shows file name, current line number, total lines in file & % of the file location

5. vi few files
i'm sure sometime you need to edit several files at once. especially those log files.
while you are in vi, you can open up other file using:
:split other_file to open other file & will split into 2 screens
Ctrl + w + w to switch between the files

while in command prompt, simply:
$ vi file1 file2 file3
:n edit next file (file2)
:n edit next file (file3)
:rew rewind to the first file (file1)

6. shell access or run a command
while editing a file in vi, you can also access shell to run specific commands without quiting from vi
:shell will gives you a command prompt, type exit when you done with the shell, will return back to vi
or simply use :!command to execute the command

7. command output into vi
don't waste time to copy & paste the command output, instead redirect it into the file
:r!cat /etc/passwd will inserts content of /etc/passwd into the current file

8. recovering your file
life is not perfect, sometime something goes wrong while you are editing your file, eg: power failure or lost connection. indeed you can recover it back by using:
$ vi -r your_filename

9. word completion
for me this feature is quite useful for developers since they most likely repeating the same words/patterns:
type a few characters of the word and then keep on pressing Ctrl + p or Ctrl + n until you find the match, but make sure the words/patterns are already there in the file.

10. get help, don't panic!
if you get lost or no idea how to do things in vi, don't panic! get help
use :h or :help to access the main help file
to go directly to specific help, give an argument to the :help command
or to search for help use :help any_word eg: :help me will bring you to the line which contains word me, pressing Ctrl + d to see matching help entries for me.
E478: Don't panic!

and of course there are a lot more vi tips out there!
happy vi-ing :)

note: certain tips are not working with vi, only for vim!

Thursday, May 25, 2006

equivalent ethtool for solaris

if you are looking for equivalent ethtool for solaris, the answer is ndd
ndd - get and set driver configuration parameters

to get your network interface card (eg: hme0) info:
# ndd -get /dev/hme link_status
# ndd -get /dev/hme link_speed
# ndd -get /dev/hme link_mode

0 for Link Down
1 for Link up

0 for 10 Mbps
1 for 100 Mbps

0 for Half-Duplex mode
1 for Full-Duplex mode

and of course for more info:
# man ndd

mii-tool vs ethtool

both commands are actually doing the same things. an useful tool to display or change ethernet cards settings, but bare in mind that mii-tool only for 10/100M NIC while ethtool can support all hardware. so in case you are using GB cards, you should use ethtool then.
# ethtool eth0
Settings for eth0:
Supported ports: [ TP ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Advertised auto-negotiation: Yes
Speed: 100Mb/s
Duplex: Full
Port: Twisted Pair
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: umbg
Wake-on: g
Current message level: 0x00000007 (7)
Link detected: yes

for more info
# man ethtool

change hostname - solaris vs linux

in order to change your machine's hostname, you will need to edit some files.

for solaris:
there are 6 files you need to edit:
/etc/hostname.network_interface (e.g hostname.hme0)
/etc/net/*/hosts (3 hosts files)

but for linux:
only 1 file

for temporary hostname (i'm not sure why you need it temporary), you can use command:
hostname new_hostname

but if you want it permanent, you need to reboot the system after changing all the necessary files.

Saturday, May 20, 2006

one-liner to check disk/file systems usage

as requested by my friend, here is the one-liner to check disk/file systems usage that exceed certain percentage:
$ df -k | sed -e 's/%//g' | awk '{if ($5 > 70) print $1 " " $5 " " $6}'
Filesystem capacity Mounted
/dev/md/dsk/d0 82 /
/dev/md/dsk/d8 78 /home

change 70 to any number that suite your need.

RX packets errors

still figuring out on why this box having RX packets errors:
# netstat -i
Kernel Interface table
eth0 1500 0 6562755167 851549 849523 849523 3191554302 0 0 0 BMRU
lo 16436 0 43728443 0 0 0 43728443 0 0 0 LRU

# ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:11:85:XE:B2:XE
inet addr:XXX.X.XXX.XX Bcast:XXX.X.XXX.XXX Mask:
RX packets:6562755167 errors:851549 dropped:849523 overruns:849523 frame:1189
TX packets:3191004809 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3964758124916 (3781087.9 Mb) TX bytes:336413334315 (320828.7 Mb)
Base address:0x3000 Memory:d6000000-d6020000

or you can see from /proc/net/dev

since this is production server, can't simply reboot to test it out. it could be hardware issue here, maybe switch, cable or the NIC itself or maybe tcp/udp packets. any clue :(

rsync error / csh bug?

one of our users complaining that he having a problem with his rsync script. the error was:
protocol version mismatch - is your shell clean?
(see the rsync man page for an explanation)
rsync error: protocol incompatibility (code 2) at compat.c(62)

there is a good way on how to debug this error:

is your shell clean

The "is your shell clean" message and the "protocol mismatch" message are usually caused by having some sort of program in your .cshrc, .profile, .bashrc or equivalent file that writes a message every time you connect using a remote-shell program (such as ssh or rsh). Data written in this way corrupts the rsync data stream. rsync detects this at startup and produces those error messages. However, if you are using rsync-daemon syntax (host::path or rsync://) without using a remote-shell program (no --rsh or -e option), there is not remote-shell program involved, and the problem is probably caused by an error on the daemon side (so check the daemon logs).

A good way to test if your remote-shell connection is clean is to try something like this (use ssh or rsh, as appropriate):

ssh remotesystem /bin/true > test.dat

That should create a file called test.dat with nothing in it. If test.dat is not of zero length then your shell is not clean. Look at the contents of test.dat to see what was sent. Look at all the startup files on remotesystem to try and find the problem.

refer to http://samba.anu.edu.au/rsync/FAQ.html

and in my case, it is because of the csh error or is it bug? somehow once csh executed this is the error message.
free(2a95e9b7c0) above top of memory. (memtop = 5c2800 membot = 58d000)

no idea what it mean (maybe related to memory problem... i dunno) but for temporary solution i changed the permission of /etc/profile.d/z-lti.csh to 600, so the csh will not sourcing this file when the user uses csh. the error gone & he able to rsync :)

Friday, May 05, 2006

free cool gadgets from thegadgetblog.com

thegadgetblog.com is giving away cool gadgets (Apple ipod, Scope watch, Wireless PC Lock, etcetera) for its 1st birthday. hopefully i win one of them :)
here is the contest

happy birthday thegadgetblog!

Thursday, April 27, 2006

back in KL

finally, i'm back in KL.
since i can't wait to go to mamak to have teh tarik, right after landed in KLIA i went to their food court to get one. without realizing how much is the price, i ordered 2 teh tarik.
it cost me RM11.80!!! mahal giler! tak sedap lak tu!!! buat spoiled jek...

anyway, really glad to be home :)
jom lepak2 kedai mamak pekena teh tarik sambil membuang masa :P

Tuesday, April 18, 2006

roaming in rome

3 days 2 nights in roma, italia was really not enough to see all the rome. a lot of things to see in here! but at least enough to cover the main ones :)

The great coleseum!
Maximus! The general who became a slave. The slave who became a gladiator. The gladiator who defied an emperor!
we arrived on friday afternoon at Fiumicino Airport and took a train to Termini. first impression when arrived at Termini was its quite a dirty place with all the rubbish loitering around & hardly see a dust bin anywhere. they are crazy drivers as well even though the roads are a bit narrow. not like in nederlands where bicycle is the main transportation, here is scooter beside metro & bus, you can see them everywhere, cilok sana sini and somehow italians hardly speak english. so its quite challenging.
we made a booking to stay in one of the hostels here (murah maa), so the owner told us to wait for her at 4pm at the hostel, actually one of her apartments. we eventually found the place (thanks to internet, printed all the maps already) & waited there for 2 hours but she never showed up. called her but no one picked up. damn! time now at 7pm, so no choice have to find other hostel/hotel. lucky us, we got a hotel for 65euro per night but shared bathroom. good enough! but actually we waited at the wrong apartment hahaha (miscommunication! blamed colbert_frommers_wannabe)

kat mana ni??? sesat!!!? :P



anyway, apart from that Rome is actually a beautiful city, especially at night. the city itself was old with historic buildings, fountains, castles, palaces, structures & statues everywhere as well as the paintings, yup its really in every corners in the city.

really impressed with the architectures, especially all the carve. made me wondered how they build up these things last time. i think i should read their history then :)

the weather was very good on that time so we were able to walk around the city but sometimes we took a bus or metro (penat giler jalan). even though not all, basically we managed to visit all the main attraction places such as colosseum, vatican city, etc, yada2 (refer to the pictures).

but the most important thing is we had the real italian pizza & cappuccino :P

vatican city. look at the crowd! its actually a queue to go inside, eventually we also joined the queue & wasted almost 2 hours before managed to go inside!

the rest of the pictures here and here

it really was a good trip & nice place! i wish i can come here again.
Roma, grazie. ciao!

Wednesday, April 12, 2006

crond ORPHAN (no passwd entry) error message

one of the users complaining that his cron job is not running. upon checking at the cron log, i found these errors:
Apr 5 01:20:00 my_server_name crond[19123]: (username) RELOAD (cron/username)
Apr 5 01:20:00 my_server_name crond[19123]: ( tmp.7440) ORPHAN (no passwd entry)
Apr 5 01:20:00 my_server_name crond[19123]: (tmp.16094) ORPHAN (no passwd entry)
Apr 5 01:20:00 my_server_name crond[19123]: (tmp.16095) ORPHAN (no passwd entry)
Apr 5 01:28:00 my_server_name crond[19123]: (username) RELOAD (cron/username)
Apr 5 01:28:00 my_server_name crond[19123]: (tmp.7440) ORPHAN (no passwd entry)
Apr 5 01:28:00 my_server_name crond[19123]: (tmp.16094) ORPHAN (no passwd entry)
Apr 5 01:28:00 my_server_name crond[19123]: ( tmp.16095) ORPHAN (no passwd entry)

and somehow there are a lot of crond processes:
# ps aux|grep -i cron
root 18855 0.0 0.0 4100 1844 ? D 01:16 0:00 CROND
root 18856 99.9 0.0 4100 1844 ? R 01:16 2:07 CROND
root 18922 0.0 0.0 4100 1844 ? D 01:17 0:00 CROND
root 18923 99.9 0.0 4100 1844 ? R 01:17 1:08 CROND
root 19123 0.0 0.0 4104 1828 ? S 01:18 0:00 crond
root 19863 0.0 0.0 4104 1844 ? S 01:19 0:00 CROND
root 19917 0.0 0.0 4104 1844 ? S 01:20 0:00 CROND
after some googling, i found out this error normally because of the user doesn't exist in /etc/passwd
but the user is exist in the /etc/passwd, so should be no problem then!
back to google & google & google again and the solution is - if your servers are integrated with LDAP or AD you better make sure you are using nscd service as well.
in my case we are using AD but the nscd process is not running, somehow dead! start the nscd service & the cron jobs are working fine now.
lesson learnt - make sure all the processes that you expect to be running, all are running well.
in case you not sure what nscd is, here is the man page:
# man nscd
nscd(8) nscd(8)

/usr/sbin/nscd - name service cache daemon

Nscd is a daemon that provides a cache for the most common name service
requests. The default configuration file, /etc/nscd.conf, determines
the behavior of the cache daemon. See nscd.conf(5).

Nscd provides cacheing for the passwd(5), group(5), and hosts(5)
databases through standard libc interfaces, such as getpwnam(3),
getp-wuid(3), getgrnam(3), getgrgid(3), gethostbyname(3), and others.
Each cache has a separate TTL (time-to-live) for its data; modifying the
local database (/etc/passwd, and so forth) causes the cache to become
invalidated within fifteen seconds. Note that the shadow file is
specifically not cached. getspnam(3) calls remain uncached as a

Monday, April 10, 2006

dutch sightseeing

an afternoon outing for dutch sightseeing in Keukenhof and Zaanse Schans .
"its 100% dutch! so dutch, that most of the dutch people won't go there" said my dutch colleague.

basically Keukenhof is a park that have millions of tulips and other bulb flowers. an overwhelming display of colour in a beautiful setting covering an area of 32 hectares that incorporates elements of traditional and modern landscape gardening.
not really my type of spot, tapi sedap la mata memandang :)

mat bunga :)


while Zaanse Schans in the other hands, reflects its 17th and 18th century roots with painted wooden houses, windmills and warehouses along the Zaan river.

inside the windmill

demonstration on how to make the wooden shoes

Burcht castle on our way to have dinner. This is in Leiden.

the rest of the pictures here and here

Tuesday, April 04, 2006

vim tip: search for a word

normally in vim you can search a word by entering / or ? then enter a word, press n or N to go to the next & previous matching word.
but you can also use * or # to search for a word under the cursor in the current file.

same with / and ? , * key will search for the word from the current cursor position to the end of the file and # key will search for the word from the current cursor position to the top of the file. just keep on pressing * or # to go to the next & previous matching word.

Friday, March 31, 2006

bash tip: search command history

from my previous post on ksh hotkeys vs bash hotkeys, i mentioned on how to use hot key to do search on command history, which is using ctrl-r
but i also mentioned that i'm not sure on how to use this key to go to the next or previous match command. i found it now :)

once you hit ctrl-r to do a "reverse incremental search". as you type, bash will search your command history and auto-fill the most recent command that matches the pattern you type in. hit ctrl-r again to go to the next most recent match. just hit ctrl-r again & again until you found the command you looking for. and if you want to go the previous match command, you can hit ctrl-s, but make sure you do this first:

disable the default terminal setting for ctrl-s & ctrl-q which is to lock & unlock your terminal.
$ stty -ixon

Thursday, March 30, 2006

shell tip: which shell you currently using

how do you tell which shell you currently using?

just use:
$ echo $0
$ bash
$ echo $0
$ csh
% echo $0
% zsh
% echo $0

Wednesday, March 29, 2006

shell tip: setting environment variables

below is the compilation on how to set environment variables for different shells

sh, ash, bsh, ksh, zsh, bash & bash2:
to set use - export TEST=test123
to unset use - unset TEST

csh, zsh & tcsh:
to set use - setenv TEST test123
to unset use - unsetenv TEST

is there any other shell out there?

guest blogger for itechtips.com

i've been invited by editor from itechtips to be guest blogger for his site.
check it out here

Tuesday, March 28, 2006

linux tip: change date

last time when i want to change the date/time, i use date command with this option:
date MMDDhhmm

$ date
Mon Mar 27 17:41:37 CEST 2006
$ date 03271630
Mon Mar 27 16:30:00 CEST 2006
but i found an option which much more easier:
$ date
Mon Mar 27 16:30:15 CEST 2006
$ date -s "Mon Mar 27 17:45:15 CEST 2006"
Mon Mar 27 17:45:15 CEST 2006
just copy & paste the current date & edit it.

Thursday, March 23, 2006

unix tip: find a character position in word

somebody asked on how to find a character position in a word/line on the unix.com forum

the question:
how to find a character position in a word/line?
Unix forum is the best site.

now in above line i want to find the character 'x' position
i.e 4

this is what i came up with:
$ echo "Unix forum is the best site." | grep -o "[-_a-zA-Z0-9\.]" | grep -n x
one of the users has a very simple solution:
$ expr index "Unix forum is the best site." x

Tuesday, March 21, 2006

cool stuff: pose nude in public

do you dare to nude in public? me, i don't think so, but not for these 1500 venezuelans. they just nude in public for photo shoot :P

CARACAS, Venezuela -- More than 1,500 Venezuelans shed their clothes on a main city avenue on Sunday to pose for Brooklyn photographer Spencer Tunick, forming a human mosaic in front of a national symbol: a statue of independence hero Simon Bolivar.
As Tunick shouted commands through a megaphone, nude people of every shape, size and skin tone gathered on the avenue and stairs in front of the statue just before dawn.
source: http://www.newsday.com/news/local/wire/newyork/ny-bc-ny--

this is the picture from nederland local newspaper, in front page! enjoy :)

script: determine variable type

i found this useful script on how to determine the variable type.
$ cat mad.ksh
#! /bin/ksh

[[ -z "$1" ]] &&amp; echo "I cant work without an input" && exit 1


[[ "$INPUT" == ?(+|-)+([0-9]) ]] && echo "$INPUT is numeric" &&amp; exit 0

[[ "$INPUT" == +([a-zA-Z]) ]] && echo "$INPUT is character" &&amp; exit 0

[[ "$INPUT" == *([0-9]|[a-zA-Z])* ]] && echo "$INPUT is alpha-numeric" && exit 0

$ ./mad.ksh 123
123 is numeric
$ ./mad.ksh abc
abc is character
$ ./mad.ksh abc123
abc123 is alpha-numeric

i hope they don't mind i paste it here.
source: http://www.unix.com/showthread.php?t=21630&p=83968

Saturday, March 18, 2006

i amsterdamed!

my friends from aberdeen, scotland came over here for 2 weeks training & on that weekend i brought them to visit what they called "sex & drugs" city - amsterdam.
image hosting by imagevenue.com
so our mission is to find out whether those are for real :P

one of the nederland landmarks - windmill taken from train on the way to get there.
image hosting by imagevenue.com
we reached here in the afternoon so we don't have enough time to explore everthing. but got a chance to visit couple of their museums which is amsterdam historical museum & sex museum. aha! we found the sex part already. are you sure? hehehe nope, there is another best part & i'm not going to tell you. go figure!

actually we can just walk around in this city, but as the weather is killing us, we just took tram instead. to our suprise mas advertisement on their tram :) should we be proud? hmmm...
image hosting by imagevenue.com

i'm a chess player, hmmm actually yahoo! games chess player :P. my friend dfhzn told me there is a giant chess in the leidseplein. here you go, while waiting for them to finish the game. as expected, white lost! but not really a giant lorr...
image hosting by imagevenue.com
just behind us is the amsterdam hard rock cafe.

actually we were planning to stay over night here, so that we can continue the exploration tomorrow, but all the hostels or even hotels are fully booked and some hotels don't even want to rent it out since we only want it for 1 night. hampeh!
just before we heading back home, we took a break & breath in their coffeeshops. as you all may know or don't know, this is the drugs part. actually they are just a regular coffeeshops, we can have coffee, tea, cappucino or whatever that in the menu but there are some special things in the menu as well. coffeeshops here are allowed to sell small amounts of cannabis or marijuana. they have it in the cake aka spacecake and also in coffee or tea even in hot chocolate. so be carefull with what your order or you'll end up with red eyes & stoned :)
image hosting by imagevenue.com
nah... we just had our regular coffee daa... :P

Wednesday, March 15, 2006

skiing in de uitholf

this is me 1st time skiing in de iutholf.
at first, it was very hard to get it balance & i fell down most of the time :P

but at last managed to get it right... it was really fun & cold of course!

hmmm maybe i'll try snowboard next time, look far more cool than ski. but they said snowboard much more harder to learn than ski... hmmm i guess i have to give it a try then :)

unix tip: sendmail - email not been sent out but queued

ever come accross with this problem? when you try to sent out email, the email can't be sent out but get queued instead!!!
# cat filename | /usr/sbin/sendmail -v yourname@domain.com
yourname@domain.com... queued

somehow, sendmail by default will check the system load average
before sent out the email. if the load average exceeds QueueLA (default 8),
it stops delivering the mail, if load average exceeds RefuseLA (default 12)
it stops accepting the mail. both of the settings are located in sendmail.cf

even you increased the value, sendmail still not works as its will give an error below.
# ps auxw | grep sendmail
root 6519 0.0 0.0 6252 2040 ? S 12:52 0:00 sendmail: rejecting connections on daemon MTA: load average: 77

so you need to set the value higher, but i'm not so sure about this.
this is my system load average: quite high huh!!!
# uptime
3:01pm up 96 days, 23:09, 15 users, load average: 78.10, 77.86, 77.57

of course you can manually flush/sent out the emails from the queue by using command below:
# /usr/sbin/sendmail -OQueueLA=80 -q 0 -v

but in this case i suggest you take a look at your system load & if possible try to decrease the load.

it took me a few days to find out this thing since there was no error message about the load average, but if you're lucky you'll get this "sendmail: rejecting connections on daemon MTA: load average:" in your log files which make easier to google :)

QueueLA default values is (8 * numproc) where numproc is the number of processors online (if that can be determined).

Tuesday, March 07, 2006

unix tip: file test operators

i always keep forgetting these file test operators, so i decided to paste it here for my future reference :)
-r file check if file is readable.
-w file check if file is writable.
-x file check if we have execute access to file.
-f file check if file is an ordinary file (as opposed to a
directory, a device special file, etc.)
-s file check if file has size greater than 0.
-d file check if file is a directory.
-e file check if file exists. Is true even if file is a

if [ -s file ]
such and such

for more info, go here http://www.tldp.org/LDP/abs/html/fto.html

Friday, March 03, 2006

unix tip: ksh hotkeys vs bash hotkeys

a few of our servers are running ksh shell instead of bash. sometimes i have
problems handling ksh hotkeys because getting used to bash hotkeys like below:

bash hotkeys:
ctrl-l -- clear screen
ctrl-r -- does a search in the previously given commands so that
you dont have to repeat long command.
ctrl-u -- clears the typing before the hotkey.
ctrl-a -- takes you to the begining of the command you are
currently typing.
ctrl-e -- takes you to the end of the command you are currently
typing in.
esc-b -- takes you back by one word while typing a command.
ctrl-c -- kills the current command or process.
ctrl-d -- kills the shell.
ctrl-h -- deletes one letter at a time from the command you are
typing in.
ctrl-z -- puts the currently running process in background, the
process can be brought back to run state by using fg
esc-p -- like ctrl-r lets you search through the previously
given commands.
esc-. -- gives the last command you typed.
tab -- auto completion

below are the hotkeys when i'm using ksh shell (you have to
set -o vi first)

ksh hotkeys:
esc-\ -- auto completion. only work if the file/command is in
current directory
esc-k -- scroll up
esc-j -- scroll down
esc-/ -- search in the previously given commands (esc-/ keyin
the command you want search & enter. press n or N to
go to the next or previous command, even ctrl-r in bash
can't go to the next or previous command or maybe i just
don't know how.
esc-= -- filename check - this is cool!!!

since its using vi mode, you can also edit the commands
using below keys
esc-l -- forward one character
esc-h -- backward one character
esc-x -- delete one character
esc-r -- replace one character
esc-e -- forward end of word
esc-b -- backward beginning of word
esc-d -- delete to end of line
esc-i -- insert text (current space)
esc-a -- insert text (adjacent space)
esc-^ -- move cursor to beginning of line
esc-$ -- move cursor to end of line

esc key is not necessary if you are currently in command-mode

Thursday, March 02, 2006

unix tip: wildcard - asterix (*) vs question mark (?)

ever wonder what is the different between asterix (*) and question mark (?) when you use them as wildcard?
here are some examples:

list all the files
$ ls
fileA fileAA fileAAA fileB fileBB fileBBB fileC fileCC fileCCC

if you use * it will listed all files
$ ls *
fileA fileAA fileAAA fileB fileBB fileBBB fileC fileCC fileCCC

but if using ? it will not
$ ls ?
ls: ?: No such file or directory

list all files that start with file
$ ls file*
fileA fileAA fileAAA fileB fileBB fileBBB fileC fileCC fileCCC

but if you use 1 ? it will listed only files that start with file+1 character
$ ls file?
fileA fileB fileC

same goes when you using 2 or 3 ?
$ ls file??
fileAA fileBB fileCC
$ ls file???
fileAAA fileBBB fileCCC

the asterix (*) is to replace zero to multiple characters while the question mark (?) only to replace a single character & of course you can use them with other commands as well such as find, grep etc...

Saturday, February 25, 2006

unix tip: kill signal

this morning I had a problem starting up one program. from the error log its stated that the program exit with signal 6.
how do i know what is the signal 6 mean?
a friend of mine show me this :)
# kill -l

and for more info about the signal, use
# man 7 signal

eventhough i know what its mean now but still i can't figure out what is the problem with the program :(

Friday, February 24, 2006

unix tip: sort processes by cpu/memory usage

you can use the following commands to sort processes by cpu/memory usage.

# top -bn1P

# top -bn1M
or just type top without any options, you'll get an interactive interface.

# prstat -s cpu

# prstat -s size

# ps -ef | egrep -v "STIME|$LOGNAME" | sort +3 -r | head -n 15

# svmon -P
summary of the top 15 processes using memory on the system, use the following command:
# svmon -Pt15 | perl -e 'while(<>){print if($.==2||$&&&!$s++);$.=0 if(/^-+$/)}'
or you can just use an topas.

Tuesday, February 14, 2006

unix tip: rename files - replace spaces with underscores

last week a friend of mine asked me how to rename a bunch of files that have spaces on its name.
this is what i came up with:
$ cat replace_spaces_with_underscores.sh
while read filenames
mv "$filenames" "`echo "$filenames"sed -e 's/ /_/g'`"
# use below line if you don't want to replace it with underscore
#mv "$filenames" "`echo "$filenames"sed -e 's/ //g'`"
done < filenames_with_spaces

but 1st u need to run this, dump filenames with spaces to one file:
$ ls grep " " > filenames_with_spaces

p/s: since i'm in nederland, maybe i should try their space cake :)

Sunday, February 12, 2006

den haag, nederland

my 3rd week in Den Haag, Nederland for 3 months business trip. the weather is freaking cold here that made me so lazy to go out. but on the 1st weekend i went to Amsterdam and got a chance to see the best part :)
hopefully i'll enjoy my stay here, like my buddy said for a few times, nice place!

Wednesday, February 08, 2006

unix tip: ssh - get rid of yes/no message

normally when you ssh to a new unix/linux box, you'll be prompted with yes/no message like below:

$ ssh hostname1
The authenticity of host 'hostname1 (ip_address_hostname1)' can't be established.
RSA key fingerprint is be:eb:c6:2f:0e:d9:56:38:8c:f7:17:cd:96:f9:3c:f5.
Are you sure you want to continue connecting (yes/no)?

most of the time you just type yes, key in your password and you are in the box. but how about you need to create a script to ssh to a few servers to run some commands? then this option become handy:

$ ssh -o StrictHostKeyChecking=no hostname1
username@hostname1's password:

key in your password and you are in and of course you can use ssh-agent to get rid of the password prompt as well :)