1. Taking CentOS as an example, modify /etc/passwd and /etc/shadow after logging in, change the root starting in the first line to a new user name (such as admin), and pass wq! # after modification. ##save.
2. After modification and saving, it will take effect after restarting the server. You can check the permissions of the file and you can see that the account column changes. It is admin, as follows:
Note: The default user with the highest administrative authority in Linux is root, and the uid is 0. Only uid is recognized in the system, so as long as uid is 0, the system considers the top administrative user. However, there may be certain problems with applications. Some software uses the root user by default. Therefore, if the understanding of the software application is limited, it is not recommended to adjust the user name for root.
The above is the detailed content of How to change the root user name in Linux. For more information, please follow other related articles on the PHP Chinese website!