How do I gain root privileges in Ubuntu Desktop 12.04? I installed to a USB stick to try it out. Now when I installed it on a VM, I don't have the same options as I did on the USB stick, such as opening remote desktop, installing drivers, and some of the video capabilities.


3 Answers 3


There are 2 ways to do things with elevated permissions.

sudo lets you run commands in your own user account with root privileges.

su lets you switch user so that you're actually logged in as root. But this options is by default disabled on Ubuntu. Instead you can simply start a root shell with sudo -i.

Read What are the differences between "su", "sudo -s", "sudo -i", "sudo su"? for more information.

Use either method only as and when needed, they can cause your system damage if used without caution.

  • sudo -i is the typical way to get a 'rootshell' on an Ubuntu box. It will log everything you do as your original user account, but you're acting as root.
    – Broam
    Nov 5, 2018 at 21:15

This should make you root after you enter your user's password, assuming you were the first account to be created. Be careful when you're root. Only login as root when you really need to, and logout as soon as you're done.

sudo su -

Alternatively you can run specific commands with root privileges by prepending them with sudo. For example:

sudo cp -p foo bar/
  • 1
    The "Ubuntu" way of getting a root terminal is sudo -i FYI.
    – Broam
    Nov 5, 2018 at 21:15

You cant gain something you already have. If you can use sudo, than you dont need to gain it.

Ua, excuse me... But sudo is not how you "gain" root privileges. sudo is used when you already have root level access from the admin group and want to use it.

The question implies "gain" as something that you do not have. Probably not written correctly.

Common Example: So you need sudo, or root on your computer but you can't use sudo BECAUSE you need to "gain" the privilege because you accidentally locked your self out etc. by editing sudoers and removing yourself because you thought you could login as root on Ubuntu.

sudo doesn't solve everything. And you can't gain something you already have.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.