Chinaunix首页 | 论坛 | 博客
  • 博客访问: 453001
  • 博文数量: 144
  • 博客积分: 5675
  • 博客等级: 大校
  • 技术积分: 1512
  • 用 户 组: 普通用户
  • 注册时间: 2008-10-20 10:46
文章分类

全部博文(144)

文章存档

2014年(1)

2013年(1)

2012年(12)

2011年(39)

2010年(48)

2009年(29)

2008年(14)

我的朋友

分类: BSD

2012-03-13 11:51:39

     在工作中经常遇到客户忘记密码的情况,多数客户都不会“取消控制台信任设置”,今天却遇到了一个这样的服务器,没办法常规的直接进入单用户模式需要root权限,而手里还没有fixcd盘,怎么办呢?
  
    先复习下如何进单用户重置root密码:
  1、系统引导后在模式选择界面选择“4”,进入单用户模式,
 
  2、进入sh命令行后,输入fsck -y /dev/ad4s1a
 
  3、mount -a
 
  4、passwd
输入两次新密码

如果设置了“取消控制台信任设置”无法进入单用户模式,怎么办呢?

取消控制台信任的设置为:
/etc/ttys 中

---------------------snip----------------------

29 # If console is marked "insecure", then init will ask for the root password

30 # when going to single-user mode.

31 console none unknown off secure <--------这行

32 #

33 ttyv0 "/usr/libexec/getty Pc" cons25 on secure

34 # Virtual terminals

35 ttyv1 "/usr/libexec/getty Pc" cons25 on secure

36 ttyv2 "/usr/libexec/getty Pc" cons25 on secure

---------------------snip----------------------

在这里我们需要把上面所指的第31行:

console none unknown off secure

改成

console none unknown off insecure

这样就设置了取消控制台信任,单用户就需要root权限了,

要想进入单用户模式 ,进行逆过程就可以了,我们另外找一个已经安装了freebsd系统的服务器,将需要破解密码的系统盘挂载到这个新的freebsd系统上:
mount /dev/da0s1a /mnt
ee /mnt/etc/ttys

console none unknown off insecure

改成

console none unknown off secure

卸载硬盘,安装会原来的机器上 ,启动进单用户,可以了吧
阅读(1514) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~