How to Become Root in Ubuntu
Method 1 of 2:
Running Root Commands with Sudo
- 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.
- 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.
- 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.
- 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.
- 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.
- For example: type gksudo gedit /etc/fstab to open the "fstab" file in GEdit, an editing program with a GUI.
- If you're using the KDE Window Manager, use kdesudo instead of gksudo.
- 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]
- Enter the command sudo passwd root. This will create a password for root, essentially 'enabling' the account. Don't forget this password.
- Type sudo -i. Enter the root password when prompted.
- The prompt will change from $ to #, indicating you have root access.
- 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
- 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
orgksudo
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.- Enabling the root user can put your system at risk and is not recommended by Ubuntu.[5]
- 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.
- Enter a password, then press ↵ Enter.
- Retype the password when prompted, then press ↵ Enter. The root user should now have a password.
- Type su - and press ↵ Enter. Enter the root password when prompted to arrive at the root prompt.
- To disable the root account, type sudo passwd -dl root.[7]
4 ★ | 3 Vote
You should read it
- How to use sudo without password in Linux
- Instructions to disable Root account on Linux
- How to Get Root Rights on Ubuntu
- Enable Root account in Ubuntu
- How to Open Applications With Root Privileges on a Mac
- How to enable root user on a Mac to take complete control of the device
- How to Change Root Password in Linux
- How to Change the Root Password in Linux
May be interested
- What's new in Ubuntu 18.04 LTS just released?ubuntu 18.04 lts code-named bionic beaver has just been officially launched on april 26th. this version is canonical's up to 5 year support period.
- Instructions to root Android easily and quicklyafter rooting your android device, you have full access to the system and can run many types of applications that require root access. these applications can disable bloatware, allow application control, enable connections and many other great things.
- How to enable root user on a Mac to take complete control of the deviceapple has turned off root user access by default. if you still want to learn how to enable root user on macos, follow the instructions below.
- Root way of Android phones 7.0 / 7.1 Nougat with KingoRootandroid 7.0 / 7.1 nougat has been officially released for a while. as the latest operating system, many users wonder how to root android quickly and easily. kingo offers android users a safe, fast and rooted android phone.
- How to prolong the life of Ubuntu 18.04 installation with Ubuntu Proubuntu 18.04, bionic beaver, is one of the most popular distros in use today, but support will end in may 2023, meaning you won't receive updates or security patches anymore.
- Top 15 best feature enhancement apps for Androidit is true that root device is becoming less and less necessary but there are still many reasons to root the device. it adds the functionality that non-rooted devices can't have as own applications. this article will give you a list of the top 15 best android root apps in 2017.
- How to check if Android device is rooted or not?root checker is an application to check android devices, from the smartphone to the tablet has been rooted or not? or does root process succeed and work effectively?
- What is the difference between Ubuntu Desktop and Ubuntu Server?ubuntu is divided into ubuntu cloud, ubuntu core, ubuntu kylin, ubuntu desktop and ubuntu server. in this article, we will explore all the similarities and differences between ubuntu server and ubuntu desktop.
- Root various Android devices with Kingo Android Rootroot is always an interesting topic for you to use android, and in this article i want to talk about a very new tool called kingo android root, called kingo for short. this is a windows-based tool, able to root for many different types of devices and the operation is quite simple.
- How to root your Android Nougat phone with SuperSUdid you decide to root the nougat android 7.0 device? supersu root android 7.0 is great software to access various android applications on rooted device. this article will guide the root steps of this android phone with this supersu.