Linux Command Learning Series-User Management 2

Source: Internet
Author: User

Let's review the previous section:

1. Basic introduction of user and user group,uid,gid, user type (normal user, system user, root user)

2. User and Group Common command id,groups,who command, add user name parameter and no user name parameter difference

3. User add command useradd, what the system does after executing the command, how to add user information through parameter customization

4. at the same time, we have left a small homework, do not know that we have finished it, the order of the homework is

Useradd–u 503–g Users–d/home/users User1

View the results as follows:

In This section, we continue to say the User Management section of the Linux command learning

1. set a password for the user:passwd Command

users cannot log on to the system until the user is created with the Useradd command, and they need to set a password for the user.

There are two ways to set a password,

1. One is the root user to set a password for the user,

passwd user name, you can set the user password, the process needs to confirm two times, while the password can not be too simple. Now let's use user1 as an example to illustrate

then we log in with User1.

2. Another is the user to set their own password

when the User1 login system, if you want to change the password, directly with the passwd can

2. Modify user information:usermod Command

Usermod command used to modify the user information has been created, such as to modify the user's home directory, you can use usermod–d/newhome, user1 as an example, we put user1 UID changed to 504, home directory to user2 ( directory to exist, does not exist with mkdir created ), Change the user group to admin , as below command

Usermode-u 504–d/home/user2–g Admin User1

when we are done with ID , we can see that the user information has changed. Note that if the home directory does not exist, you need to use the mkdir command to create one, this command is very simple,mkdir directory name can be

3. Delete user information : Userdel Command

The Userdel command is used to delete user information, the commonly used parameters are -R and –f,-F to force the deletion of users ,-r means to delete user-related directories and files at the same time, for security reasons, It is best notto use-R to reduce risk.

Delete The user1 we created, execute userdel–r user1, because we are testing, so in order to remove the clean point, with the- r parameter

here is a detail, because user2 the owner of this folder is not user1 so will not be deleted, here are some of the relevant knowledge of the permissions, and so on the right to elaborate.

The additions, modifications, and deletions to this user have been completed. For everyone to leave a job, modify user1 user ID for 505, home directory to admin, user Group for admin, and finally delete user1 User


More articles about the public number "kick genius"


Linux Command Learning Series-User Management 2

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.