Chinaunix首页 | 论坛 | 博客
  • 博客访问: 733843
  • 博文数量: 235
  • 博客积分: 4309
  • 博客等级: 中校
  • 技术积分: 2325
  • 用 户 组: 普通用户
  • 注册时间: 2011-01-17 11:25
个人简介

If you don\\\\\\\\\\\\\\\'t wanna do it, you find an EXCUSE; if you do, you\\\\\\\\\\\\\\\'ll find a WAY :-)

文章分类

全部博文(235)

文章存档

2014年(3)

2013年(2)

2012年(31)

2011年(199)

分类: BSD

2012-05-10 20:10:03


  1. How I recovered a lost root password in FreeBSD

  2. This was on a CyberGuard LX firewall, running version 4.2 BSD

  3. Luckily I did know one user name and it had no password.
  4. cgadmin

  5. Using the boot CD, pick option 4 for single use mode
  6. going through the country and keyboard

  7. going to the repair mode with CDROM/DVD option off the install menu,
  8. using the "live" CDROM filesystem gave me a root prompt Fixit#

  9. now mounting the hard drive, in my case /dev/ad0s3a

  10.     mount /dev/ad0s3a /mnt

  11. now edit the master password file

  12.     vi /mnt/etc/master.passwd

  13. on the root line, delete all characters between the first two :: to remove
  14. the root password altogether.
  15. hence ending up with
  16. root::0:0::00:Charlie &:/root:/bin/csh or something similar

  17. save the file

  18. now change permissions, but look at them first, make a note so you can put
  19. them back to the correct setting later
  20. chmod 777 /mnt/etc
  21. chmod 666 /mnt/etc/master.passwd

  22. reboot

  23. remove the CD and reboot the original system.
  24. For some reason my older FreeBSD version 4.3 filesystem did not like being
  25. mounted onto a FreeBSD 6.1 install CD
  26. Hence on reboot it made me do a manual fsck
  27. Then another reboot

  28. Now login as a user, cgadmin in my case
  29. get a prompt and run

  30.     pwd_mkdb /etc/master.passwd

  31. This rebuilds the secure password database

  32. Now get another getty - say Alt-F4 and login as root
  33. Amazing!!!!

  34. Reboot if you like, set yourself a new root password and write it down this
  35. time
  36. I prefer a label on the bottom of the box, because if you have got this
  37. access, you can crack the password.

  38. Now don't forget to set the file security back to where it was chmod 755 /etc chmod 600 /etc/master.passwd Hope you enjoyed the day. Derek

FROM: 
阅读(864) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~