ubuntu 忘记登陆密码


第一种方法:

无论你是否申请了root帐号,或是普通账号密码忘记了都没有问题的!

1、重启ubuntu,随即长按shift进入grub菜单;2、选择recovery mode,按"e"键进入编辑页面;3、将ro single替换为rw single init=/bin/bash;4、按ctrl+x进入单用户模式,当前用户即为root;5、到/etc目录下修改sudoers权限:chmod 0440 sudoers,搞定;也可以同时新增root密码,下次就不这么麻烦了;

    修改密码操作:#passwd

      输入新密码:#    

  再输入一遍密码:#

    这是设置root密码,如果是设置其它用户密码使用命令:passwd 用户名 即可

6、按ctrl+alt+del重启;

如果你的普通用户没有忘记的话,那么好办了,记得我们还有一个强大的sudo么?

第二种方法:

1、进入终端 #sudo su root然后输入普通用户的密码,就暂时获得了root帐号的权限了,同时也进入了root账号下了;

这时我们可以为所欲为了;不信的话你切换几次账号,看看行不行;嘿嘿

2、这是我们就可以做一切只有root用户能做的事了,包括修改root用户的密码,都是可以的;


另外

Booting into recovery mode

  1. Switch on your computer.
  2. Wait until the BIOS has finished loading, or has almost finished. (During this time you will probably see a logo of your computer manufacturer.)
  3. Quickly press and hold the Shift key, which will bring up the GNU GRUB menu. (If you see the Ubuntu logo, you've missed the point where you can enter the GRUB menu.)
  4. Select the line which starts with "Advanced options".

  5. Select the line ending with "(recovery mode)", probably the second line, something like:

    Ubuntu GNU/Linux, with Linux 3.8.0-26-generic (recovery mode)
  6. Press Return and your machine will begin the boot process.
  7. After a few moments, your workstation should display a menu with a number of options. One of the options (you may need to scroll down to the bottom of the list) will be "Drop to root shell prompt". Press Return with this option highlighted.

  8. The root partition is mounted read-only. To mount it read/write, enter the command

    mount -o remount,rw /
  9. If you have /home, /boot, /tmp, or any other mount point on a separate partition, you can mount them with the command

    mount --all

    (This must be done following step 8 so that /etc/mtab is writable.) Alternatively, you could try selecting "Enable networking" in step 7, though this has been found to cause the system to hang (see https://bugs.launchpad.net/ubuntu/+source/friendly-recovery/+bug/981792).

NOTE 1: If you have Ubuntu Quantal (12.10) or earlier, omit step 4 (the recovery mode menu items are displayed on the top-level menu).

NOTE 2: If you reboot, there is no need to hold the Shift key in step 3. The GNU GRUB menu will continue to be displayed automatically on each boot until a normal startup of Ubuntu completes. To configure GRUB so the menu is always displayed, even after a normal startup, see https://help.ubuntu.com/community/Grub2/Setup.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值