Reset Root Password of Extman

公司架了套邮件系统,弄好,跑了段时间,晕,密码忘了,怎么办?毛主席说过,自已动手,丰衣足食啊。解决办法:

1.找到/extman/docs/init.sql,用VIM打开它。
vim init.sql
:set nu
25 INSERT INTO `manager` VALUES (‘root@extmail.org’,’$1$BrT9qxfB$Ha81Mb5YVV6rNKNN5jmtj1′,’admin’,’root’,’Super User’,’my question’,’my answer’,’0′,’2007-02-14 15:10:04′,’2    010-11-08′,1);

(约25行)
找到这字段:$1$BrT9qxfB$Ha81Mb5YVV6rNKNN5jmtj1
复制下来,退出VIM

2.打开mysql命令行终端:
mysql -uroot -p****(你的数据库密码) -p /var/mysql/mysql.sock(mysql的sock文件)

3.进入终端
mysql > use extmail;
执行如下SQL语句
mysql > update manager set password=’$1$BrT9qxfB$Ha81Mb5YVV6rNKNN5jmtj1′ where username=’root@extmail.org’;
这里的set password=‘$1$BrT9qxfB$Ha81Mb5YVV6rNKNN5jmtj1’里面将我们先前从init.sql中复制的字段粘贴在这里。

4.执行OK,退出mysql> exit

5.重新登录http://your domain/extman/cgi/index.cgi
输入系统初始化时的密码:extmail*123*,OK,完了。

Reference Link: http://www.extmail.org/forum/thread-22121-1-1.html

How to chroot Ubuntu using Live CD to fix GRUB rescue prompt

Recently I messed up GRUB boot loader in my laptop installed with Ubuntu which resulted in grub rescue prompt. So I had to boot Ubuntu Live CD to get it fixed. Thought of blogging it, may be useful for some one.

This fix involves two steps. First one is to chroot into Ubuntu installation partition. Second one is to install the grub MBR (Master Boot Record). I am using Ubuntu Lucid 10.04 and Live CD also of same.

Step-1: Boot your machine with Ubuntu Live CD and select Trying Ubuntu without installation option when it is prompted (Live CD mode)

Step-2: Be patient till you get complete desktop ready.

Step-3: Ubuntu main menu -> Places -> Home Folder -> Look for other partitions listed on left hand side pane. Mount one by one and identify your Ubuntu root partition. When you are in your root partition, press Ctrl+L to view the complete mount path. Press Ctrl+C to copy this path. This path is normally/media/xx..xx kind of long path, where xx..xx denotes your hard disk partition unique id.

If you know your Ubuntu root partition you can replace the above GUI step-3 with simple mount command like this (Applications -> Accessories -> Terminal):

$ sudo mount /dev/sdax /mnt/myroot (where sdax is your root partition)

Let’s say you have mounted root partition at /media/xx..xx.

Step-4: $ Run the terminal through Applications -> Accessories -> Terminal.

Step-5: Run the following commands to export the pesudo file system of Live CD to your would be root file system soon.

$ sudo mount ‐‐bind /dev /media/xx..xx/dev

$ sudo mount ‐‐bind /proc /media/xx..xx/proc

$ sudo mount ‐‐bind /sys /media/xx..xx/sys

Step-6: Changing the root file system of live system to your hard disk installed root file system.

$ sudo chroot /media/xx..xx

Step-7: Installing GRUB Boot record in Master Boot record of your hard disk. My hard disk is sda. Replace your hard disk device node in the following command.

$ sudo grub-install /dev/sda

Step-8: Reboot the Live Ubuntu. Eject the CD.

Now you should get boot menu for your Ubuntu installation back. Enjoy the Ubuntu!

Reference Link: http://karuppuswamy.com/wordpress/2010/06/02/how-to-chroot-to-ubuntu-using-live-cd-to-fix-grub-rescue-prompt/