How do I change from user to superuser (root)? What command do I use in the Terminal to switch to root? I have tried --help but I get lost with all the listed help. I'm looking for a recent download/install so I can use it.


4 Answers 4


Launch an instance of your terminal (press CTRL+ALT+T or search for "terminal" in the Dash). This will give you your normal shell from which you can run commands or programmes without root access.

To get root access, you can use one of a variety of methods:

  1. Run sudo <command> and type in your login password, if prompted, to run only that instance of the command as root. Next time you run another or the same command without the sudo prefix, you will not have root access.

  2. Run sudo -i. This will give you an interactive root shell. Note that the $ at the end of your prompt has changed to a #, indicating that you have root access. But you fall in the root home directory (/root/). From here you can run any sequence of commands as root, or run the command exit to leave the root shell.

  3. Use the su (substitute user) command to get a root shell. This is effectively the same as using sudo -i. Note that when you use this command it will ask for the root password and not your login password. These are not the same. You may have to set or change the root password by running sudo passwd root first.

  4. Run sudo -s. This gives you root access, but maintains your current SHELL. Shell specific settings, including your current directory, are preserved. For instance if you use bash (Ubuntu's default shell), aliases (and any other settings from ~/.bashrc) are kept when you switch to the root user. To leave the root access, type exit as in the cases above.

Be advised that playing around with root access is dangerous, and if you had to ask about root access, you probably shouldn't have the privilege. You have the potential to completely ruin your entire system with the mis-execution of many commands. Be careful and verify what you are doing before you do it. Google is Search engines are your friends.

  • 7
    your answer is wrong: sudo -s will give you an interactive root shell at your current directory. and it is not completely equal to su (different $HOME). -- sudo -i gives you a complete root environment! -- see askubuntu.com/q/418122/354350 Jul 29, 2017 at 1:07
  • 2
    @DJCrashdummy you are totally correct, thanks for auditing this answer. Not sure why I wrote that sudo -i drops you into a shell in your current directory... Must've been a late night on 3 May 2015, since that's obviously not true :) Answer updated. Aug 10, 2017 at 1:22
  • 4
    Excellent to see all the different methods in one place!
    – wogsland
    Jul 29, 2020 at 16:10
  • 1
    sudo -s worked for my use case without asking for password Mar 24, 2021 at 9:54
  • In my PC, Ubuntu 23.04 x64, sudo -s works.
    – Vy Do
    May 29 at 3:06

This is my way.

Open a terminal an run this command:

sudo su -

The command starts a login shell and you will find yourself in root's home directory with root's environment.

  • 6
    su - ask for password su root asks for password, but there is no root password made after live install. sudo su - jumps right into root, wow. Dec 4, 2018 at 4:53
  • I used exit command from logged-in user. It opens the root user shell.
    – kiran
    Mar 6, 2021 at 13:13
  • 1
    @TimothyL.J.Stewart lol thank you. this helped and was funny :)
    – Bryan_C
    Mar 21 at 7:15

You can use sudo -i which will ask for your password. You need to be in the sudoers group for that or have an entry in the /etc/sudoers file.
Another way is the command su - which will ask for the password of root, but accomplish the same.


Just type su - You gone be asked for your password and after putting it in you'll be logged in as the root user

You must log in to answer this question.

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