How to Become Root in Ubuntu
Press Ctrl+Alt+T to open a terminal window., Type sudo before the rest of your command., Type gksudo before running a command that opens a program with a Graphical User Interface (GUI)., Simulate a root environment., Give sudo access to another user.
Step-by-Step Guide
-
Step 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.Instead, start your commands with sudo. -
Step 2: Type sudo before the rest of your command.
“Sudo” stands for “Super 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. , For security reasons, Ubuntu does not recommend using “sudo” to open programs with GUIs.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. , 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.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. , 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). -
Step 3: Type gksudo before running a command that opens a program with a Graphical User Interface (GUI).
-
Step 4: Simulate a root environment.
-
Step 5: Give sudo access to another user.
Detailed Guide
Because Ubuntu locks the root account by default, you cannot use su to become root as you would in other Linux distributions.Instead, start your commands with sudo.
“Sudo” stands for “Super 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. , For security reasons, Ubuntu does not recommend using “sudo” to open programs with GUIs.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. , 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.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. , 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).
About the Author
Jeremy Powell
Jeremy Powell specializes in lifestyle and practical guides and has been creating helpful content for over 4 years. Jeremy is committed to helping readers learn new skills and improve their lives.
Rate This Guide
How helpful was this guide? Click to rate: