Tuesday, May 24, 2011

How to rebuild qmail queue

This article is about how to rebuild qmail queue if it is damaged or consists of a lot of spam messages and wants to get rid of it.

Attention!
All current messages will be removed from the mail queue if you are following the steps below and cannot be restored the mails in the mail queue.


  • Stop qmail service 
[root@server~]# service qmail stop (or) /etc/init.d/qmail stop
  •  Then delete the folders under qmail queue and create the queue folder structure
[root@server~]# cd /var/qmail/queue
[root@server queue]# rm -rf info intd local mess remote todo
[root@server queue]# mkdir mess
[root@server queue]# for i in `seq 0 22`; do mkdir -p mess/$i; done;
[root@server queue]# cp -r mess info
[root@server queue]# cp -r mess intd
[root@server queue]# cp -r mess local
[root@server queue]# cp -r mess remote
[root@server queue]# cp -r mess todo
[root@server queue]# chmod -R 750 mess todo
[root@server queue]# chown -R qmailq:qmail mess todo intd
[root@server queue]# chmod -R 700 info intd local remote
[root@server queue]# chown -R qmails:qmail info local remote

  • Start the qmail service
service qmail start (or) /etc/init.d/qmail start

Saturday, May 21, 2011

How to reset CentOS root password with GRUB boot loader

Sometimes you may forget root password of CentOS system, which happened to me a few times with some of the development server.
Here is how to reset it.

You need to reboot the system ether by reset button or power recycle.
At the boot up GRUB screen you need to press any key to get the boot menu. By default GRUB has 5 second delay to display boot menu which is configured in "/boot/grub/menu.lst". You need to act quick.

Screen outputs:

Press any key at GRUB boot up.


Press 'e' after choosing one of the boot up kernel menu.


Select the list with "kernel /vmlinuz-" and press "e"


At the following screen, add word "single" with space after the end of existing line as shown in picture below and press "Enter"


You will get back to GRUB menu list and press "b" to boot


The system will boot up and automatically login and prompt you with shell prompt.


Then enter "passwd" to change root password and reboot the system.


You can login now with new password!


Friday, May 20, 2011

How to migrate Plesk license key from old server to new server with CentOS

If you are having problem with plesk license key to move from old linux server to new linux server, it is simple task.
Just download and install new server with trial key. After Plesk is up and running in new server, copy the key file from old server to new server.
key file location:
/etc/sw/keys/keys
There is key license xml files under the above directory.
Make sure to shut down the old server after you activate the new server.

Thursday, May 19, 2011

How to use ssh client in Cisco devices to access another ssh server

If you want to access ssh server for administration works from cisco switch. You can use the following command to access the ssh server from switch.

cisco# ssh -l username ip_address

e.g output for accessing linux ssh server through cisco switch.
cisco# ssh -l root 192.168.1.1

Password:
Last login: Thu May 19 10:08:04 2011 from 192.168.1.1
[root@linux ~]#