How to Become Root in Ubuntu

Method 1 of 2:

Running Root Commands with Sudo

  1. How to Become Root in Ubuntu Picture 1
    Press Ctrl+Alt+T to open a terminal window. Because Ubuntu locks the root account by default, you cannot use su to become root as you would in other Linux distributions.[1] Instead, start your commands with sudo.
  2. How to Become Root in Ubuntu Picture 2
    Type sudo before the rest of your command. 'Sudo' stands for 'substitute user do.' When you add sudo to the beginning of a command, the command will run as root.
    1. For example: sudo /etc/init.d/networking stop stops the network service, and sudo adduser adds a new user to the system. Both of these tasks require root access.
    2. You will be prompted to enter your password before sudo runs the command. Linux stores your password for 15 minutes so you won't have to keep typing it.
  3. How to Become Root in Ubuntu Picture 3
    Type gksudo before running a command that opens a program with a Graphical User Interface (GUI). For security reasons, Ubuntu does not recommend using 'sudo' to open programs with GUIs.[2] Instead, type gksudo before the command that launches the program.
    1. For example: type gksudo gedit /etc/fstab to open the "fstab" file in GEdit, an editing program with a GUI.
    2. If you're using the KDE Window Manager, use kdesudo instead of gksudo.
  4. How to Become Root in Ubuntu Picture 4
    Simulate a root environment. If you are an advanced user who needs access to an actual root shell to run specific scripts, simulate a root shell with sudo –i. This command will give you superuser access with root's environment variables.[3]
    1. Enter the command sudo passwd root. This will create a password for root, essentially 'enabling' the account. Don't forget this password.
    2. Type sudo -i. Enter the root password when prompted.
    3. The prompt will change from $ to #, indicating you have root access.
  5. How to Become Root in Ubuntu Picture 5
    Give sudo access to another user. If you are setting up an account for someone who does not currently have root access, you will need to add their username to the sudo group. To do this, type usermod -aG sudo username (but replace 'username' with the correct username).[4]
Method 2 of 2:

Enabling the Root User

  1. How to Become Root in Ubuntu Picture 6
    Press Ctrl+Alt+T to open a terminal window. For security purposes (and to avoid damage), the root user account is locked by default. To safely run commands as root, you should use sudo or gksudo instead. If you absolutely must have a separate root user (if it's required by a program used by your business, or this workstation will only be used by a single user), you can enable the root user with some simple commands.
    1. Enabling the root user can put your system at risk and is not recommended by Ubuntu.[5]
  2. How to Become Root in Ubuntu Picture 7
    Type sudo passwd root and press Enter. You will be prompted to set a new password for the root user.[6] Don't lose this password.
  3. How to Become Root in Ubuntu Picture 8
    Enter a password, then press Enter.
  4. How to Become Root in Ubuntu Picture 9
    Retype the password when prompted, then press Enter. The root user should now have a password.
  5. How to Become Root in Ubuntu Picture 10
    Type su - and press Enter. Enter the root password when prompted to arrive at the root prompt.
    1. To disable the root account, type sudo passwd -dl root.[7]
4 ★ | 3 Vote

May be interested

  • How to Uninstall Ubuntu SoftwarePhoto of How to Uninstall Ubuntu Software
    this wikihow teaches you how to uninstall software from a computer running ubuntu linux, as well as how to uninstall ubuntu from your computer. if your computer is running both linux and a different operating system, you can erase the...
  • How to Install FreeNX Server on Ubuntu 9.04 JauntyPhoto of How to Install FreeNX Server on Ubuntu 9.04 Jaunty
    freenx is an open source server for remote desktop connection that works over both high and low speed internet connections. it can be installed in ubuntu from the [https://launchpad.net/~freenx-team/+archive/ freenx team ppa]. create and...
  • How to Install Postman in UbuntuPhoto of How to Install Postman in Ubuntu
    this wikihow teaches you how to install postman on a computer running the ubuntu linux operating system. postman is a tool commonly used by developers to test apis. make sure snap is installed. if you are running ubuntu 16.04 lts or later,...
  • How to Install Ubuntu 13.10Photo of How to Install Ubuntu 13.10
    ubuntu is a kind of linux operating system designed to run on desktop and laptop computers. ubuntu is an open-source program, meaning its code can be accessed and modified by end users. and because it's free, ubuntu is said to be the most...
  • How to Install Tomcat in UbuntuPhoto of How to Install Tomcat in Ubuntu
    this wikihow teaches you how to download, set up, and start an apache tomcat web server environment on your computer, using an ubuntu linux system. apache tomcat is an open-source, java-based http web server environment. you can implement...
  • How to Get Help for UbuntuPhoto of How to Get Help for Ubuntu
    although ubuntu is considered to be one of the best linux distributions for newcomers, you still may find yourself in need of help whether this is your first time using a linux based os or if you're an experienced user. making the switch...