We need to set root permissions, because in some cases, you will need the root password to install something, so let's first introduce the first thing you need to do, which is called passwd (the word means set password). Setting the root password in Linux is very similar to Windows, that is, there is a super administrator, but the super administrator of Linux is called root, and Windows is called Administrator. Then we use passwd to set root, and then our super administrator password is set. Because we are now ordinary users who want to set users with higher permissions, it is obvious that the operating system will not recognize the direct operation command. So we must add a prefix called sudo provided by the Ubuntu system. This prefix command is equivalent to elevating the privileges for ordinary users. Therefore, when we operate system-related configuration files in the future, we often need to use a command like sudo on ordinary users to form the entire operation together with the following commands.
So the main function of sudo is to elevate privileges. After clicking the Enter key, it will ask what the password is and then enter the new password. This new password is the root password. Of course, it can be the same as the original password. Then the password is entered successfully. Remember that during the password setting process, the password display is not like Windows. Its password will not be displayed but hidden, so you will not see it when you enter the password.
So Linux hides all passwords for security reasons.
The command to switch users is su (which stands for upgrading from ordinary users to root users, provided that there is nothing after the horizontal line) plus - (the role of the horizontal line is to convert environment variables together. For example, if I go from this room to another room, I will take everything in my room with me).
After pressing Enter, you will start to enter the password, which is the root password. After entering, we will find that it changes from rocky to root, which means that we are now operating and configuring the system as root.
It doesn’t matter if it doesn’t match. Just assume that the rocky password is the root password.
The above is the first thing we do after installing Linux.