I'm wondering about the root account being disabled in Ubuntu and whether it makesany difference to security. If someone hacks into your PC they can type:

user@user:/home$ sudo -i
root@r00t:~# Voila, i am root and I don't have root password, right?

That's an example from my PC , up , so why exactly disable it? For many years I had no doubt about disabled root but now I have this in my mind more and more...

If anyone already hacked into your account/PC via IP or however, what's the difference if root is disabled/enabled if they just have to type sudo -i to get root?

Here's a quote from a post here:

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 log in as root but to 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

 sudo passwd root

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.

closed as unclear what you're asking by andrew.46, Zanna, Byte Commander, Pilot6, David Foerster Sep 22 '16 at 10:15

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    what is your question actually? sudo -i won't give you root shell unless you type your password (if you're in sudo group). That is the settings in Ubuntu. – Anwar Sep 22 '16 at 7:58
  • 4
    Disabling root login is to stop reckless users logging in as root, not to stop malicious activity by others. – Zanna Sep 22 '16 at 8:02
  • 2

Firstly, the example from your PC is a fake example because the hostname doesn't change when you do sudo -i, obviously. Here is a real example:

zanna@monster:~$ sudo -i
[sudo] password for zanna:

(I entered my own user password). Now since I don't actually need this root shell to do anything the first thing I'm going to do is exit it.

The main point of disabling root login is to prevent reckless behaviour by users. There's no reason to use root privileges unless you really need to: logging in as root all the time reduces the security of the system to that of a virus- and malware-prone Windows system.

If someone with malicious intent manages to get the password of a user with sudo privilege, then you're in just as much trouble as you would be if they had the root password. Ubuntu's design decision in disabling root login makes no difference to that.

  • This has inspired me to come up with a creative hostname for my own computer. – Nonny Moose Nov 8 '18 at 0:46

Not the answer you're looking for? Browse other questions tagged or ask your own question.