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.

Allowing users in the "wheel" group to run commands without a password the polkit way

As proposed in a KDE forum post,

/*kate: hl JavaScript ;
  Allow members of the wheel group to execute any actions without password authentication!
  Of course, this vital example is not given in the official manpage.
  in   /etc/sudoers.d/10-installer  do  #comment out any shenanigans!
  Globally --   Create the following text file as root:

sudo leafpad /etc/polkit-1/rules.d/49-nopasswd_global.rules

  additionally, use    NOPASSWD:   in   visudo :
  ## Allow root to run any commands anywhere   in  /etc/sudoers
  you   ALL=(ALL)    NOPASSWD: ALL  ###   also try:


polkit.addRule(function(action, subject) {
    if (subject.isInGroup("wheel")) {
        return polkit.Result.YES;

Debian 10

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



one month ago
Score 0++


never enter a darn password again!
Add your comment
LinuxReviews welcomes all comments. If you do not want to be anonymous, register or log in. It is free.