Ubuntu как узнать пароль root
Перейти к содержимому

Ubuntu как узнать пароль root

  • автор:

LostPassword

Sometimes it is necessary to get root access, for example when you have forgotten your password or changed something in /etc/sudoers and things do not work as expected.

Be careful, because this step will give you full root access to your system and you can really damage your system! Keep in mind that all the steps you see here can also be done by someone else!

Now let us start with a way that should work on any freshly installed Ubuntu system:

The Standard Way

  • Press return, then you will be prompted to enter and confirm a new password.
  • Give root password for maintenance (or type Control-D to continue):

then you will have to try a different trick below.

The Other Way

If the "Standard Way" does not work for you and you recieve the "Give root password for maintenance" message, you can recover your password using the following steps

1. Reboot your computer

2. Press SHIFT or ESC at the grub prompt (as earlier).

3. Select your image.

4. Highlight the line that begins kernel and press ‘e’ to edit

5. Go to the very end of the line, change the ro to rw and add init=/bin/bash

press enter, then press b to boot your system.

Your system will boot up to a passwordless root shell.

6. Type in passwd username

7. Set your password.

8. Type in reboot

The Other Way Lucid

At least for ‘Lucid’ I found out that the steps 1-5 in the procedure mentioned above are slightly different:

1. Reboot your computer

2. Hold shift during boot to start GRUB menu

3. Highlight your image and press ‘e’ to edit

https://amdy.su/wp-admin/options-general.php?page=ad-inserter.php#tab-8

4. Find the line starting with linux and append init=/bin/bash at the end of that line

5. Press ctrl-x to boot.

Then follow the steps 6-8 as mentioned above.

LostPassword (последним исправлял пользователь mail 2014-04-11 09:08:07)

The material on this wiki is available under a free license, see Copyright / License for details
You can contribute to this wiki, see Wiki Guide for details

How to find out root password for installing software

I’m trying to install the NetBeans IDE in my Ubuntu and in the process it’s asking for my root password which I don’t remember. I know my sudo user password. How can I recover my root password?

karel's user avatar

9 Answers 9

As default Ubuntu has no password set for the root user, i.e., the account named root . To gain root privileges as another user you have to type in your own password. This is the password you set for the first user account while installing Ubuntu.

To set a password for the root , run the following command in a Terminal shell:

After this you are asked to type in the new password twice. After this the root account has its own password, so you can actually log in with the user name root .

Как узнать пароль на root

как можно изменить пароль? не могу войти на компьютер. спрашивает пароль пользователя? как я могу найти его.

aleksandr barakin's user avatar

По поводу заголовка вопроса:В Убунте вход от имени пользователя root по-умолчанию запрещён, и пароля у него нет. Воспользуйтесь командой sudo и вводите свой пароль. Пользователь, соответственно, должен иметь привилегии (см /etc/sudoers).Ссылко

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

Загрузка в однопользовательский режим

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

  1. Включите компьютер и дождитесь экрана выбора ОС (если выбор не появляется, нужно нажать клавишу ESC во момент загрузки).
  2. Как только удалось попасть в меню загрузчика, наведите курсор на нужную систему и нажмите клавишу E . Вы попадёте в простой редактор для этого пункта.
  3. Найдите строчку, начинающуюся с linux , и добавьте в конец слово single .
  4. Загрузитесь с изменёнными настройками, нажав F10 .
  5. Через некоторое время вы попадёте в привилегированный режим. Наберите там команду passwd пользователь и установите пароль указанного пользователя системы.
  6. Затем введите команду exit , и загрузка продолжится как обычно. Но пароль уже будет сменён.

Подмена демона инициализации

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

    Для этого на этапе редактирования настроек пункта в загрузчике (см. №3 выше) надо вместо параметра single писать init=/bin/bash .

Загрузившись (клавиша F10 ), надо примонтировать корневой раздел на запись.

Затем аналогично меняете пароль утилитой passwd.

* в systemd это делается маскированием юнита rescue.target .

Загрузка с Live образа

Администратор может запретить менять параметры загрузки, поставив пароль на GRUB. Это осложнит предыдущие пункты, и придётся прибегнуть к помощи установочной флешки.

Загрузив Live систему с флешки (или по-старинке с CD), в терминале примонтируйте системный раздел целевой ОС. Найти его можно утилитами fdisk или GParted.

Потом смените корневой каталог

Смените пароль также как и в предыдущих вариантах программой passwd.

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

Редактирование базы данных пользователей

В предыдущем случае, чтобы прошёл фокус со сменой корня, подопытная система и система с флешки должны быть архитекурно совместимы. Если это не так, можно отредактировать файл /etc/passwd целевой ОС.

    Откройте passwd файл, который содержит список пользователей, в любом текстовом редакторе (или даже в любой ОС, в которой есть поддержка линуксовой ФС).

Найдите нужного пользователя (имена в первой колонке до двоеточия) и уберите любые символы вплоть до второго двоеточия в строке. Это сбросит пароль пользователя на пустой.

Пример: в файле было

Загрузившись в целевую систему желательно заново установить пароль.

Но на самом деле, что по-настоящему защитить данные от несанкционированного доступа, их стоит зашифровать. В этом случае можно быть уверенным, что вышеизложенные инструкции не подойдут. А если вы вдруг забыли пароль от криптоконтейнера, то самое простое решение — забыть про него. Впрочем, это не тема настоящего ответа.

Finding root password

I installed a Ubuntu and it only has a user. I can login to the system without login. It doesn’t ask me for un/pwd. but when I am in, and I want to run some commands as root (sudo), it ask for password and not allowing me to run it. No password works. How can I find password for this user or root?

2 Answers 2

By default, on Ubuntu, there is no password for the root account. To run a command as root, you must run sudo , which asks for your own password. The Ubuntu installation creates one account with sudo privileges and asks you to enter a password for that account.

If you’ve forgotten the password, you’ll have to change it. First, you need to be able to run a command as root (as a non-privileged user, you’d have to enter the current password to change it). The easiest way to do this if you aren’t fluent with the Linux command line is to boot the Ubuntu installation media and select “rescue” rather than “install” at the menu. Alternatively, at the boot menu (you may need to press and hold Shift when your computer is booting, after the BIOS has initialized, to see the boot menu), select the “rescue” option or edit the command line to add init=/bin/bash at the end — see Lost Password in the Ubuntu community documentation for more details (this page may not be very up-to-date).

Once you get a command line as root, run this command to change your password:

(where joe is your user name). Then reboot into your normal system, and don’t forget the password this time.

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *