Linux getting started Tutorial: How to manually create a Linux User
When we want to create a user, we immediately think of The useradd command or create a user in the image. However, we do not really understand how to generate a linux User, we know that everything is a file in linux. For a user, the following files are usually worth noting:
/Etc/passwd (User)
/Etc/group (User group)
/Etc/shadow (key file)
/Home/username (home Directory)
/Etc/skel/. * (skeleton file)
Yes, you can manually create a linux User as long as the preceding files can be set. If you don't talk much about it, we will immediately start to operate (set it in the above order ):
-------------------------------------- Split line --------------------------------------
Linux User Management
Linux User management commands
Common commands for Linux User Management
Common commands for Linux user and group management
Linux _ users, groups, and permissions
Linux users and group commands
Linux User and permission management
-------------------------------------- Split line --------------------------------------
1. Add content in the last line of/etc/passwd:
We can use the id command to view our user information, but it is obviously not perfect. We will continue to add.
2. Add group information in/etc/group:
3. At this time, we only have user and group information, and there is no home directory. We need to create and change the users and groups of the directory to achieve security permissions:
4. now we can switch to this user and perform operations. At this time, we find that the beginning of each line is much more simple than that in the previous root user operating environment, that's because we didn't copy the skeleton file to its home directory. Of course, this is not complete, and you should note that we haven't set a password for this test user. It is obviously not correct:
Let's take a look at it, isn't it? Well, we finally set the password to make the user more secure.
5. Set the password for the/etc/shadow file
Paste the encrypted password in the/etc/shadow file.
Because the file level is very high, only wq! After all, the password management file is:
Note: You can search for the content of the nine parts. (: Separated content)
At this point, a complete user addition is over. This process is what we do when executing useradd and passwd. Pay attention to the user-related files, only by understanding such distribution can we have a deep understanding of user management in linux.
Conclusion:
Some people always divide the content difficulty of linux into elementary, intermediate, and advanced. In fact, all the knowledge points are very important to us, whether it is difficult or simple, in the face of practical problems, we need to master the linux system in a solid manner.
This article permanently updates the link address: