HOWTO su into root on Debian and Ubuntu systems

From LinuxReviews
Jump to navigationJump to search

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:

sudo /bin/bash

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.

   even easier: see https://forum.kde.org/viewtopic.php?f=15&t=156389&p=409080&hilit=polkit#p408592

Debian 10

Debian 10 has the su binary and you can just su - to become root.