Forgot my root password on linux

How to Reset Forgotten Ubuntu Password in 2 Minutes

If you forgot your user password on Ubuntu, don’t worry. You can reset an Ubuntu password very easily. This guide explains an easy method for changing the root password on Ubuntu. The method should also be applicable to other Linux distributions.

Forgot your Ubuntu login password? It happens. If you haven’t used Ubuntu for some time, it’s only natural to not remember the password. The good news is that you don’t need to reinstall the entire operating system because of it. You can recover Ubuntu passwords easily. The method mentioned here works for resetting an Ubuntu password in VMware, dual boot or single install. All you need is a little bit of patience and to run a couple of commands. You’ll reset the root password within minutes. Using Linux on WSL? It’s a bit different for WSL. You may follow the steps for resetting Linux password in WSL here.

Reset Ubuntu password from recovery mode

If you prefer watching videos to reading text, I’ve also made a video of this tutorial. Don’t forget to subscribe to our YouTube channel for more Linux tutorial videos. Advanced boot options in Grub menu of UbuntuIn here, you’ll see the option to go to recovery mode: Boot into recovery modeIt will bring you to a black screen with several lines of output being displayed in a flash. Wait for a few seconds here.

Step 2: Drop to root shell prompt

Root shell prompt allows you to reset password in Ubuntu

Now you’ll be presented with different options for recovery mode. Here you need to choose “Root – Drop to root shell prompt“. Just press the enter key to select this option. Like in the picture below: You’ll see that when you select the root shell prompt option, an option to enter commands appears at the bottom. This is your root shell prompt and this is where you’ll use the commands to reset the password.

Step 3: Remount the root with write access

You need to have write access to the root partition. By default, it has read-only access. Use the command below to remount it with write access: mount -rw -o remount /

Step 4: Reset username or password

Based on this command, choose the “username” for which you want to reset or (say) hack the password. Now, use the following command to reset the password for the selected “username“:

Читайте также:  Failed to start kerberos 5 key distribution center astra linux

Do note that nothing is displayed on the screen when you start typing the password. This is perfectly normal and actually a security feature in Linux systems. Just blindly type the password and press enter.

Enter new UNIX password: Retype new UNIX password:

Use recovery mode to boot normal after resetting password in Ubuntu

When you exit, you’ll be back at the recovery mode menu. Select the normal boot option here. There will be a warning about graphics mode compatibility. Don’t worry. A complete reboot will fix any issues with this. You should now be able to log in with the new password.

Possible Troubleshoot:

While entering the new password you might be prompted with Authentication token manipulation error like this: passwd username Enter new UNIX password: Retype new UNIX password: passwd: Authentication token manipulation error passwd: password unchanged The reason for this error is that the file system is mounted with read access only. Change the access and remount the file system in the following manner:

Now try to reset the password again. It should work now. As you can see, it is extremely easy to change Ubuntu password even if you’ve forgotten it. It will barely take a few minutes.

Alternate method to reset Ubuntu password

If for some reason you have difficulty dropping to the root shell and changing the password, you can try these steps.

Step 1

Reboot your computer. Hold shift to bring up the grub screen (if it doesn’t appear automatically). Press E at the grub prompt to edit the grub screen.

Step 2

Editing grub to fix frozen boot issue with Ubuntu Linux

Find the line starting with linux, change the ro to rw and append init=/bin/bash at the end of that line.

Step 3

Press ctrl-x to save your changes and boot. Now you are booting into the Linux kernel with read and write permissions, and instead of going to a graphical user interface, you’ll use the bash shell. In other words, your system will boot up to a passwordless root shell.

Step 4

Type in the passwd command with your username. If you don’t know the username, check with ls /home command (as mentioned in method 1). Set your new password. Once you’ve set the new password, exit the terminal. Just type reboot in the terminal or use the shutdown command.

If resetting Ubuntu passwords is this easy, isn’t this a security risk?

That’s a fair question. One of the main advantages of Linux over Windows is its security. But if “anyone” can reset the password, how come Ubuntu or other Linux distributions can be considered secure? Let me explain a few things here. The main security risk is if someone hacks into your account from a remote location via the internet. That’s not happening here. If anyone has physical access to your computer, the data in your computer is already at risk. Unless the entire disk is encrypted, anyone can “steal” your data using a live USB without even entering your installed operating system. By default, Ubuntu doesn’t have a root password and the root account is locked. The user account you set up while installing Ubuntu is included as an admin with sudo rights. But that doesn’t mean that you are root. This lack of root password is a deliberate feature The “advanced options for Ubuntu” in the boot menu allow you to perform some specific root-related tasks from the “root shell prompt”. This is why you’re able to reset the Ubuntu password through this method. If you want to make your system more secure, you can either encrypt the disk (to save your data) or setup a password for root user in Ubuntu.

Читайте также:  Vipnet client dst linux

Bonus Tip: Handling the possible keyring issue after changing the password

There is a keyring feature in Ubuntu that is used for keeping passwords locked and safe. When you reset the forgotten password, the keyring remains unlocked and you may see an error message like this. Enter Password To Unlock Your Login Keyring UbuntuOpen the Passwords and Keys application and here, delete the Login passwords. Delete Keyring UbuntuWhen you try to use Google Chrome again in Ubuntu, it will ask you to create a new keyring. Use the new login password as the keyring password.

Did it help you?

Donate Itsfoss

I hope I made things clear about resetting forgotten passwords in Ubuntu. Did this quick tip help you recover your admin password? Do share in the comments below.

Источник

Как сбросить пароль в Linux

Давайте рассмотрим несколько способов сбрасывания системного пароля в Linux. Вы наверное знаете, что у пользователя root есть права на изменение пароля любого пользователя в системе. А что если вы забыли пароль от рута? Вот об этом и пойдет речь в статье.

При восстановления пароля (рута или любого другого пользователя) встречаются две различные ситуации, требующие разного подхода.

Когда можно использовать GRUB

  • В окне загрузчика GRUB выделите строку с нужной версией линукса, для которого вам нужно сбросить пароль
  • Нажмите ‘e’ для редактирования. Выберите строку ядра. Добавьте ‘single’ в конец строки. Нажмите ‘b’ для загрузки. Если система продолжает запрашивать пароль рута, добавьте в конец строки init=/bin/bash Снова нажмите ‘b’ для загрузки

    После этого вы либо увидите приглашение для рута, либо восстанавливающее меню, где нужно выбрать строку с рутом. Используйте passwd для того чтобы изменить пароль у любого пользователя

Когда нет возможности использовать GRUB

  • Загрузитесь с live CD
  • Выберите «Попробовать Ubuntu без изменений на вашем компьютере» (Try Ubuntu without any changes to your computer)

Источник

Восстановление root пароля в Ubuntu

img

Забыли рутовый пароль для входа в Ubuntu Linux? Не беда. Сейчас расскажем, как быстро восстановить доступ.

Упомянутый здесь метод работает для сброса пароля Ubuntu в VMware, двойной загрузки или одиночной установки. Все, что вам нужно, это немного терпения и выполнить пару команд. Вы сбросите пароль root в течение пары минут.

Если нужна другая сборка, то мы также рассказывали про восстановление пароля в CentOS и Debian

Сброс пароля в Ubuntu

Сброс пароля Ubuntu из режима восстановления (recovery mode)

Шаг 1. Загрузитесь в режиме восстановления

Включите компьютер. Зайдите в меню Grub. Как правило, оно появляется автоматически, а если нет, то удерживайте клавишу Shift, пока не появится меню загрузки.

Если вы используете Oracle VirtualBox или VMWare, вы должны удерживать клавишу Shift при появлении логотипа Oracle или VMWare.

В меню grub выберите «Дополнительные параметры для Ubuntu» (Advanced Options for Ubuntu) :

 Advanced Options for Ubuntu

Здесь вы увидите возможность перейти в режим восстановления (recovery mode) :

recovery mode

Выбрав его, вы сначала увидите темный экран и после непродолжительной загрузки окажитесь в меню восстановления.

Шаг 2. Переходим в командный интерпретатор суперпользователя

Теперь вам будут представлены различные варианты режима восстановления. Здесь вам нужно выбрать «Root Drop to root shell prompt» («Перейти в командный интерпретатор суперпользователя» по-русски) . Просто нажмите клавишу Enter, чтобы выбрать эту опцию.

 Root Drop to root shell prompt

После этого у вас внизу появится командная строка.

Шаг 3: Перемонтировать рут с правами записи

У вас должен быть доступ на запись к корневому разделу. По умолчанию он имеет доступ только для чтения. Используйте команду ниже, чтобы перемонтировать ее с правами записи:

Шаг 4: Сбросьте имя пользователя или пароль

Здесь вам будет представлен root-доступ. Используйте следующую команду, чтобы получить список всех доступных пользователей:

Из предыдущей команды выберите пользователя (username), для которого вы хотите сбросить пароль. Теперь используйте следующую команду для сброса пароля для выбранного пользователя (вместо username указываем имя нашего пользователя):

У нас запросят новый пароль и подтверждение. Введите новый пароль дважды:

Enter new UNIX password: Retype new UNIX password:

Готово! Вы только что успешно сбросили пароль. Теперь выйдите из командной строки root:

Когда вы выйдете, вы вернетесь в меню режима восстановления. Выберите нормальный вариант загрузки — Resume.

Resume

Может появится предупреждение о совместимости графического режима, но не волнуйтесь. Полная перезагрузка решит проблему, если таковая имеется.

После перезагрузки вы сможете войти с новым паролем.

Альтернативный метод сброса пароля Ubuntu

Если по каким-либо причинам у вас возникли трудности с переходом в корневую оболочку и сменой пароля, вы можете попробовать выполнить следующие действия:

Перезагрузите компьютер. Удерживайте Shift, чтобы открыть экран grub (если он не работает автоматически). Нажмите E в приглашении grub для редактирования экрана grub.

Найдите строку, начинающуюся с linux , измените ro на rw и добавьте init=/bin/bash в конце этой строки.

 init=/bin/bash

Нажмите Ctrl-X , чтобы сохранить изменения и загрузиться. Теперь вы загружаетесь в ядро Linux с правами на чтение и запись, и вместо графического интерфейса пользователя вы будете использовать оболочку bash. Другими словами, ваша система будет загружаться в корневой пароль без пароля.

Введите команду passwd с вашим именем пользователя. Если вы не знаете имя пользователя, проверьте с помощью команды ls/home (как в первом методе).

Теперь установите новый пароль. После того, как вы установили новый пароль, выйдите из терминала. Просто введите reboot в терминал или используйте команду выключения.

Возможные проблемы и их решение

Ошибка “Authentication token manipulation error”

При вводе нового пароля у вас может появиться сообщение об ошибке манипулирования токеном (Authentication token manipulation error):

passwd username Enter new UNIX password: Retype new UNIX password: passwd: Authentication token manipulation error passwd: password unchanged

Причиной этой ошибки является то, что файловая система монтируется только с доступом для чтения. Измените доступ и перемонтируйте файловую систему следующим образом:

Нет пункта “recovery mode”

Если нет пункта recovery mode, то вам нужно выбрать строчку с вашей системой, нажать E и допишите в конец опций ядра слово single . Затем нужно нажать B чтобы загрузился тот же терминал с правами суперпользователя.

Ошибка “end Kernel panic”

Вы можете увидеть такой вывод:

end Kernel panic - not syncing: Attempted to kill init! exit code=0x0007f00

Убедитесь, что вы удалили опцию splash boot при редактировании пункта меню grub.

Ошибка “Failed to connect to bus”

При попытке перезагрузиться с помощью команды reboot вы можете получить:

Failed to connect to bus: No such file or directory Failed to talk to init daemon.

Чтобы избавиться от этой ошибки перезагрузитесь так:

Источник

Оцените статью
Adblock
detector