免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2311 | 回复: 2
打印 上一主题 下一主题

刚装上gentoo2005.1 [ 已解决] [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-03-07 17:57 |只看该作者 |倒序浏览
怎么办?
不知道当初自己没有设这个密码
难道要重装吗?555555555555

[ 本帖最后由 lynnLinux 于 2007-3-7 18:16 编辑 ]

论坛徽章:
0
2 [报告]
发表于 2007-03-07 18:00 |只看该作者
单用户 single  sudo -u root passwd直接修改

论坛徽章:
0
3 [报告]
发表于 2007-03-07 18:17 |只看该作者
Overview

The basic idea behind this is to boot from the LiveCD, chroot into your system, and run the passwd program to change the root password. Because you are 'inside' the Gentoo environment on your hard drive, your password on your hard drive will be the one that is updated.

Note: If possible, it is much simpler to append "single" to the kernel options in your bootloader. The system will start up in a minimal runlevel, dropping you off at a shell as root without prompting for a password. The passwd command can then be used to change the forgotten password as below.
[edit]
Procedure

Boot from the LiveCD. Any of them will do, as long as it matches your architecture. From the LiveCD prompt, you want to mount your Linux partitions. You will probably want to mount every partition that would otherwise be mounted if you booted normally. Consider the following partition table (this is the default partition table in the gentoo 2005.1 handbook):
Partition         Mount Point
/dev/hda1         /boot
/dev/hda2         swap
/dev/hda3         /

In this case, nothing more than hda3 is necessary. However, when in doubt, mount it. Here is how you would go about that:

mount /dev/hda3 /mnt/gentoo
mount /dev/hda1 /mnt/gentoo/boot
mount -t proc none /mnt/gentoo/proc

The last mount command mounts the special /proc directory, because certain programs will request access to it. Remember: order matters! /boot and /proc are all inside /, which is why they are mounted AFTER / itself! Also, for such a small excursion into your system, you probably will not need to activate your swap.

Now that your system is mounted, the next step is to chroot into it. This step is easy enough; simply run the following command:

chroot /mnt/gentoo /bin/bash

Your prompt will change slightly to reflect the transition from the LiveCD environment to your computer. As far as the programs know, you have just logged into the root account on your hard drive. So change your password:

passwd

Type exit to exit the chroot, and reboot to reboot the machine. Take out the LiveCD before the boot process starts, and you should now be able to log into your machine as root with the password you just set.
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP