sudo -i makes me root with sudo password

sudo -s, sudo su the same

su and su root need root password so it doesn't make sense to me, I can be root with only sudo password so why root password exist?

  • 1
    By default there is no root password. Password access for the root user is disabled. Why did you set a root password?
    – muru
    Jun 30, 2021 at 9:10
  • So why it is possible to set root password?
    – pjk
    Jun 30, 2021 at 9:21
  • A root password exists to be able to login as root. Usually the user root is handled with special care, often makes root the only user which is able to login into a system when a critical system error occurred. For example, when your /home directory is mounted on a different drive and this drive has a malfunction and Linux cannot mount it - this making every user unable to login, but the root user may still be able to login, cause his home directory is /root.
    – paladin
    Jun 30, 2021 at 9:22
  • 1
    @paladin the root user is a user, why shouldn't it be possible to set a password for them? It's perfectly possible to have a system without sudo, after all.
    – muru
    Jun 30, 2021 at 9:26
  • 1
    @pjk Whoever has sudo rights is also able to login into root account without password.
    – paladin
    Jun 30, 2021 at 10:47

1 Answer 1


The answer to your question is quite simple. On Ubuntu, the root password does not exist. The root account is not enabled. Thus, the root user cannot login on a standard Ubuntu system.

Instead there is the sudo system where selected "normal" users can assume administrator priviledges. So if you want a terminal with root privileges, su will not work, because root is not active. However, you still can obtain such prompt with sudo -i, where you act as a privileged normal user, thus provide your own user password.

See here for a more elaborate discussion of sudo versus logging in to the root account. You will learn you can activate the root account. If you then ask "Why root password exist if I can be root with sudo -s or sudo -i, it need only sudo password so?", well, in this case it is you who created the contradictory situation. By default, that situation is not there.

  • Okay now I'm really close to understand it but I have one more question from my comment above, let me copy it: for example I have two users on my linux, peter and john. peter is in sudo and he is the owner of pc, john is also in sudo but peter don't want john to be able to use root account, so only peter knows root password but john still can be root because he is in sudo so he can just use sudo -i and that's it? In this situation john should't be in sudo group to avoid it?
    – pjk
    Jun 30, 2021 at 10:42
  • sudo su will work, or just sudo passwd will enable any sudo-user to set a root-password.
    – paladin
    Jun 30, 2021 at 10:51
  • @pjk being administrator is a job of trust. If there are two root users that do not trust each other, then that has to be solved at the management level, not at the level of the operating system ;) So indeed, one can be taken away root privileges if need be (and if that person did not yet destroy the system yet).
    – vanadium
    Jun 30, 2021 at 10:58
  • @paladin yes, root can do everything, including activating the root account. Being administrator is a job of trust.
    – vanadium
    Jun 30, 2021 at 10:59
  • Being able to have root access without a password still have its advantages - for instance you can still login as root with SSH keys even if the password is not set. This is far more secure than using a password. Jun 30, 2021 at 11:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .