foreword
Time cannot be met, and Tao cannot be done in vain.
1. The difference between "users" in Linux
1. Ordinary users and privileged users
windows
There are ordinary users and privileged users in the system. Privileged users areadminister
, and there can be many ordinary users. Privileged users are system administrators who have operation rights to all files in the system. Each ordinary user can only process its own files and cannot access them. Files of other users, not to mention operating system files.- Similarly,
Linux
there is also a difference between ordinary users and privileged users. Privileged users are rootroot
users , and the rights of ordinary users are restricted. For example, ordinary users cannotcd / root
, and ordinary users cannot useapt-get install
to install software.
2. Conversion command~
~
: Represents the host directory of the current user (the so-called host directory is the default directory designed by the operating system for the current user to store files and work, such as the "My Documents" directoryWindows
inWindows
,Linux
In , each user has its own home directory. For ordinary users, this directory is at:/home/username/
, and forroot
users (administrators), it is at:/root
.
2. Initial password setting of root in Liunx
- When the Linux operating system is just installed, it is not possible
Terminal
to runsu
commands , because root does not have an initial password, and we need to manually set it manually.
Specific steps to set a password for the root user
- Open a terminal and enter the following command:
sudo passwd root
- After pressing Enter, you will be prompted to enter the original password, new password and confirm the new password:
The difference between su and sudo is:
- The password for su is that of root, and the password for sudo is that of the user
- su directly changes the identity to root, and sudo is to run commands as root after the user logs in, without knowing the root password.