Linux-group and user management-group

Source: Internet
Author: User

Linux-group and user management-group

1:/etc/passwd

Open the file and you can see that each row is divided into seven fields, for example, root: x: 0: 0: root:/bin/bash. The first field indicates that the user name is root user. The second field stores the password of the account, where unix was stored in the early stage. For security reasons, replace it with x in/etc/shadow. The third field indicates that the user's uid (master) root is 0, that is, the highest permission 1-499 is the system's management account. Normal users start from 500, such as flex: x: 500: 500: flex: /home/flex:/bin/bash The fourth field indicates that the user's gid (group) is similar to the uid
The fifth field is a comment, which is meaningless and can be blank. The sixth field is the user's home directory. After the root user logs on/Root: After flex is logged onYou can modify this field in/home/flex. To change the home Directory The seventh field is the user's shell 2:/etc/shadow Open under root Root: $6 $ vaI79WVF5ElMdhec $ assets/q2EeEZ6Kj13SmzUiXE7C/eSBtH/McTTGxZ41ocCFzJd. oPIGlxeQ42RGJdR10E20: 16918: 0: 99999: 7 ::: Nine fields in total The first field is the user name. The second field indicates that the password has been encrypted. The third field is the date on which the password was last changed. The fourth field is the number of days after which the password can be changed. The default value is 0, which is unlimited. The fifth field indicates the number of days after which the password expires, and 99999 indicates that the password will never expire. The sixth field indicates the warning period before the password expires. The seventh field is the account expiration date. The premise is that the password expires. If the user does not change the password, the account will be locked after the expiration time. The eighth field indicates the time when the account exists. The ninth field is meaningless. 3: added the groupadd [-g] group name for the user group. Groupadd maid New GroupKgtest1 Groupadd-g 511 maidAdd GroupThe value of the gid of the kgtest2 parameter is 511. 4. Delete the groupdel user group. Groupdel kgtest2: if there are other accounts under the group "maid", you must delete the account before deleting the group. 5: add the USER command useradd [-u UID] [-g GID] [-d HOME] [-M] [-s] -M indicates that the home directory is not created.-s indicates the custom shell. Useradd test10 create a test10 user and create a group with the same name as the user Useradd-u 510-g 513-s/sbin/nologin user11 6. delete a user Userdel [-r] username -R deletes the home Directory of the user. 7. Change Password Passwd change root Password Passwd username: change the password of an account 8: sudo Add the account flex ALL = (ALL) ALL to execute this command in/etc/sudoers. The user flex can use the sudo command  

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.