Home >System Tutorial >LINUX >How to open root account in ubuntu
How to open the root account in Ubuntu (with specific code examples)
In the Ubuntu operating system, the root account is disabled by default, but use the sudo command to execute commands as an administrator. But in some scenarios, we still need to open the root account to obtain higher permissions and perform some special tasks in the operating system, such as system-level configuration and changes.
The following will introduce in detail how to open the root account in Ubuntu and provide specific code examples.
Switch to root user
Execute the following command in the terminal to switch to root user:
sudo -i
After entering the password of the local user, you will switch to root user, and the terminal's prompt will change to a prompt running as root.
Set the password of the root account
Execute the following command in the terminal to set the password of the root account:
passwd
The terminal will prompt you to enter a new password, enter two times to confirm the password. In this way, the password of the root account is set successfully.
Enable root account login
Execute the following command in the terminal to edit the lightdm configuration file:
sudo nano /etc/lightdm/lightdm.conf
Add the following content at the end of the file:
greeter-show-manual-login=true
Save and close the file.
Restart the lightdm service
Execute the following command to restart the lightdm service:
sudo service lightdm restart
In this way, the root account can log in to the Ubuntu system.
Note:
After opening the root account, be sure to use root permissions with caution, because the root account has the highest permissions in the system. When performing operations that do not require root privileges, it is still recommended to use an ordinary user and use the sudo command to perform operations.
Summary:
Through the above steps, you can successfully open the root account in the Ubuntu operating system and obtain higher system permissions. When you need to make some special system-level configurations and changes, the root account can help you complete these tasks more conveniently. But please use root privileges with caution to avoid unnecessary risks to the system.
Thank you for reading this article, if you have any questions please feel free to ask.
The above is the detailed content of How to open root account in ubuntu. For more information, please follow other related articles on the PHP Chinese website!