HOWTO su into root on Debian and Ubuntu systems
The Ubuntu way of running commands as the root user is to use sudo to run every single command from your regular user.
This approach may be good for security but it is quite tiresome if you want to execute a series of commands. Sometimes you just want to be root. Luckily it's really easy to su into the root user on Debian and Ubuntu even though you're not supposed to. You have the bash shell executable handy - so just use it:
and that's it, that's all you need to do to get into a root shell on Ubuntu systems. Alternatively, there's the passwd command for changing your password. If you just
sudo passwd you're changing the root users password. Just set a password you'd like to use with
sudo passwd and use that to become root when you need to by typing
su - and root's password.
You can also get a root shell
sudo by adding the
-i option - which is a short-hand option for
--login. Just run
sudo -i and you get a root shell.
Debian 10[edit | edit source]
Debian 10 has the
su binary and you can just
su - to become root.