UbuntuLinux has a distinctive feature, that is, when you use it for the first time, you cannot log on to the system as the root user. Why? This should begin with the installation of the system. For other Linux systems, the root password is usually set during the installation process, so that the user can use it to log on to the root account or use the su command to convert to the Super User identity. In contrast, Ubuntu does not set a password for the root user or enable the root account when it is installed by default. The problem is, what should I do if I want to run the command as a root user?
Ubuntu Linux has a distinctive feature, that is, when you use it for the first time, you cannot log on to the system as the root user. Why? This should begin with the installation of the system. For other Linux systems, the root password is usually set during the installation process, so that the user can use it to log on to the root account or use the su command to convert to the Super User identity. In contrast, Ubuntu does not set a password for the root user or enable the root account when it is installed by default. The problem is, what should I do if I want to run the command as a root user? It doesn't matter. We can use the sudo command for this purpose.
Sudo is a common tool in linux that allows common users to use superuser permissions. This command provides the Administrator with a fine-grained access control method, through it, people can access the system both as Super Users and as other types of users. The advantage of this is that administrators can grant some specific types of Super User Permissions without telling the user the root password, which is what many system administrators dream.
It's easy to set the allocation. Just set a root password for the root user: $ sudo passwd root
You will be prompted to enter the root user password, enter the root password continuously, and then use: $ su
You can switch to the super administrator user to log on!
1. After executing the sudo passwd root command on the terminal, the system will prompt you to set a new root account password.
2. Click System-> Preferences-> Login Window menu, switch to the Security option page, and select the "Allow local system administrator login" option.
After performing the preceding two steps, you can use the root account to log on to the Ubuntu system.
If you want to disable the root account again, run sudo passwd-l root.
Method 2:
Use the root account to log on to Ubuntu
In fact, I personally think this is not necessary, because when you need the root permission, you can use sudo. If you need to enable the root account in Ubuntu, perform the following operations:
1. Reset the root password:
$ Sudo passwd root # Enter the new password twice as prompted and confirm it.
2. Enable root User Logon:
$ Sudo vi/etc/TPD. conf #
Open the gnome configuration file, input: AllowRoot press enter in the last line mode, find AllowRoot = false, change false to true, save and exit.
After that, you can log on to the system as the root user. If you want to disable the root account, run the following command:
$ Sudo passwd-l root
The root account in Ubuntu is disabled by default. In this case, if you want to use the root permission to do something, you need the sudo command. For some friends, they may need to activate the root account in Ubuntu.