Linux ubuntu пользователь root

How to enable root login?

I would like to enable the root account on my Ubuntu installation. I realize the security implications of this.

5 Answers 5

Warning

Enabling

To actually enable root logins first you have to set a password for the root account and then unlock the locked root account. If you don’t set a password for the root account the passwd command will return

passwd: unlocking the password would result in a passwordless account. 

So, first execute in a terminal

you will be prompted for a new Unix password. Write it twice (second for confirmation).

to unlock the account. This should return

passwd: password expiry information changed 

Reverting

If you want to disable root account in Ubuntu you need to lock the root account by using the following command sudo passwd -l root

Alternatives to root login

If you want to work on a root console you can also use sudo -i .

Only do this if you know what you are doing. More information on why to stay with sudo here

Graphical version needs setting up 1st:

pkexec gnome-terminal will open a terminal with a root prompt.

passwd root will allow you to create a password for root.

Note: Running users-admin with elevated privileges no longer works because of a bug that is marked as «Won’t Fix» for security reasons. See https://bugs.launchpad.net/ubuntu/+source/gnome-system-tools/+bug/685215 for an explanation.

im1

pkexec users-admin will open the users screen:

Documentation

The link only explains why it’s bad to login as root and doesn’t give any reason why it’s bad to have a root account. As it is on any system with recovery mode, the root account still exists and so if not «enabled» root shell needs no password.

I performed the above steps, but there is still no possibilitie to login as root at the start page. Only my user name and guest.

I have an Ubuntu VM and after following this procedure I can log in as ‘root’ from the console, but I cannot ssh in as ‘root’.

You can enable the root account by setting the password as

while it is not recommended at all. From help Ubuntu

Enabling the Root account is rarely necessary. Almost everything you need to do as administrator of an Ubuntu system can be done via sudo or gksudo. If you really need a persistent Root login, the best alternative is to simulate a Root login shell using the following command.

Use at your own risk!

Logging in to X as root may cause very serious trouble. If you believe you need a root account to perform a certain action, please consult the official support channels first, to make sure there is not a better alternative.

Once enable you can disable the root account as

Читайте также:  Командная строка linux wget

Here are the links to enable root login for Ubuntu 12.04 & Ubuntu 12.10

In Linux there is a special account called root. By default it is locked in Ubuntu but you can enable the root account.

This is normally not a good idea however and you should consider very carefully before enabling the root login.

There are several good reasons not to login as root but use sudo instead including

  • Users don’t have to remember an extra password (i.e. the root password), which they are likely to forget (or write down so anyone can crack into their account easily).
  • It avoids the «I can do anything» interactive login by default (e.g. the tendency by users to login as an «Administrator» user in Microsoft Windows systems), you will be prompted for a password before major changes can happen, which should make you think about the consequences of what you are doing.
  • sudo adds a log entry of the command(s) run (in /var/log/auth.log). If you mess up, you can always go back and see what commands were run. It is also nice for auditing.
  • Every cracker trying to brute-force their way into your box will know it has an account named Root and will try that first. What they don’t know is what the usernames of your other users are. Since the Root account password is locked, this attack becomes essentially meaningless, since there is no password to crack or guess in the first place.
  • Allows easy transfer for admin rights, in a short term or long term period, by adding and removing users from groups, while not compromising the Root account. sudo can be setup with a much more fine-grained security policy.

This is discussed in more detail in the RootSudo Comunity Documentation

If you have a number of commands which would normally require sudo you can type sudo -i before the first command then exit after the last to avoid repeatedly typing sudo. To run a GUI application with root priviledges press ALT + F2 and enter gksu or gksudo followed by the name of your program (unless you are using the KDE desktop in which case the command is kdesu .

For example gksu nautilus runs the file manager with root privileges.

As you can see it is almost never necessary to enable the root login.

That said to enable the root login all that is required is to set a root password

and set a password. You will then be able to login as root but for all the reasons I have given above and more I would not recommend you do it.

Источник

RootSudoRu

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

Читайте также:  Установить пакет linux firmware

По умолчанию учетная запись суперпользователя отключена в Ubuntu. Это означает, что вы не сможете зайти в систему как root. Однако, инсталлятор настраивает sudo для пользователя, созданного во время установки. Команда sudo позволяет выполнять все приложения, требующие привилегий суперпользователя.

Когда sudo спрашивает пароль, вы должны ввести пароль ВАШЕГО пользователя ! То есть пароль root’a вам не нужен !

Заметки

  • Пароль сохраняется по умолчанию на 15 минут. По истечении этого времени, вам нужно будет ввести пароль снова.
  • Несмотря на то, что при вводе пароль не отображается на экране (даже в виде звездочек), он все-равно вводится!
  • Для выполнения графических конфигурационных утилит с sudo, просто запустите приложение через меню.
  • Для запуска программ через sudo, которые обычно запускаются под обычным пользователем (например gedit), нажмите Alt+F2 и введите gksudo gedit. В Kubuntu используйте вместо gksudo программу kdesu.
  • Использование sudo в командной строке:

Пример #1 — смена пользователя и группы для файлов в домашней папке пользователя

sudo chown bob:bob /home/bob/*

Пример #2 — перезапуск сетевых служб

sudo /etc/init.d/networking restart
  • Для запуска графических программ используйте gksudo или kdesu, иначе попытка входа может провалиться. Если это происходит и при входе вылазит ошибка: «Unable to read ICE authority file», войдите в безопасный терминал и выполните следующую команду, подставив своё имя пользователя:
  • Для запуска режима суперпользователя в терминале (root shell, т.е. командная строка, где вы можете выполнять команды под пользователем root), запустите терминал и выполните команду:
sudo -i (эквивалент команды "sudo su -")
sudo -s (эквивалент команды "sudo su")

Разрешение другим пользователям использовать sudo

Чтобы разрешить пользователю использовать sudo, откройте Система → Администрирование → Пользователи и группы. Затем выберите пользователя и нажмите на кнопке Свойства. В появившемся окне зайдите на вкладку Привилегии пользователя и поставьте галочку Администрировать систему.

Аналог этой же процедуры в терминале: sudo adduser $user admin, где $user — имя пользователя.

Преимущества использования sudo

  • Программа установки задаёт меньше вопросов.
  • Пользователям не нужно запоминать дополнительный пароль, который они могут забыть.
  • Перед тем как произойдёт выполнение команды, вас попросят ввести пароль. Это даст время подумать о возможных последствиях.
  • sudo добавляет в лог выполненные команды (/var/log/auth.log).
  • Все попытки взломщиков, пытающихся подобрать пароль к root, будут обречены на провал.
  • sudo позволяет легко предоставлять права администратора на долгий или короткий период другим пользователям, просто добавляя и удаляя их из группы, при этом не трогая корневую учетную запись.
  • sudo можно настроить с более fine-grained политикой безопасности.
  • Аутентификация автоматически истекает по окончании определенного промежутка времени.

Минусы использования sudo

  • Redirecting the output of commands run with sudo can catch new users out. For instance consider sudo ls > /root/somefile will not work since it is the shell that tries to write to that file. You can use ls | sudo tee -a /root/somefile to append, or ls | sudo tee /root/somefile to overwrite contents. You could also pass the whole command to a shell process run under sudo to have the file written to with root permissions, such as sudo bash -c "ls > /root/somefile".
  • Во многих офисных системах только один локальный пользователь в системе root. Все остальные пользователи импортируются через NSS технологии, такие как nss-ldap. Для настройки рабочей станции в случае повреждения сети, при поломке nss-ldap, необходим root. This tends to leave the system unusable unless cracked. An extra local user, or an enabled root password is needed here.
Читайте также:  Забыл пароль от рута linux

Заблуждения

  • Разве sudo не менее безопасно, чет su?
    • Основая модель безопасности одинакова в обоих случаях, поэтому и уязвимость будет одинаковой. Любой пользователь, использующий su или sudo рассматривается как привилегированный пользователь. If that user’s account is compromised attby an attacker, the attacker can also gain root privileges the next time the user does so. The user account is the weak link in this chain, and so must be protected with the same care as root. On a more esoteric level, sudo provides some features which encourage different work habits, which can positively impact the security of the system. sudo is commonly used to execute only a single command, while su is generally used to open a shell and execute multiple commands. The sudo approach reduces the likelihood of a root shell being left open indefinitely, and encourages the user to minimize their use of root privileges.
    • Вам потребуется ввести пароль для этого. Console users have access to the boot loader, and can gain administrative privileges in various ways during the boot process. For example, by specifying an alternate init(8) program. Linux systems are not typically configured to be secure at the console, and additional steps (for example, setting a root password, a boot loader password and a BIOS password) are necessary in order to make them so. Note that console users usually have physical access to the machine and so can manipulate it in other ways as well.

    Возврат к традиционной учетной записи root

    Info <! data-lazy-src=

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