System User Account Management

Source: Internet
Author: User
System User account management Linux is a multi-user multi-task time-sharing operating system. any user who wants to use system resources must first apply for an account from the system administrator, then enter the system as this account. On the one hand, the user's account can help the system administrator to use it... information & System User account management Linux is a multi-user multi-task time-sharing operating system. any user who wants to use system resources must first apply for an account from the system administrator, then enter the system as this account. User accounts can help system administrators track users who use the system and control their access to system resources. They can also help users organize files and provide security protection for users. Each user account has a unique user name and password. After you enter the correct user name and password during logon, you can access the system and your home directory. To manage user accounts, you must add, delete, and modify user accounts. · User password management. · User group management. 1. Management of user accounts in Linux systems involves adding, modifying, and deleting user accounts. To add a user account is to create a new account in the system, and allocate resources such as user numbers, user groups, home directories, and logon shells to the new account. The newly added account is locked and cannot be used. 1. add a new user account and use the useradd command. The syntax is as follows: the useradd option user name has the following meanings:-c comment specifies an annotation description. -D directory specifies the user's main directory. if this directory does not exist, you can use the-m option to create a main directory. -G user group specifies the user group to which the user belongs. -G user group, which specifies the additional group to which the user belongs. The-s Shell file specifies the user's logon Shell. -U user number specifies the user number of a user. If the-o option is available at the same time, the user ID of another user can be used again. User name specifies the login name of the new account. 2. Example 1: # useradd-d/usr/sam-m sam this command creates a user sam, the-d and-m options are used to generate a main directory/usr/sam for the logon sam (/usr is the parent directory of the default user main directory ). Example 2: # useradd-s/bin/sh-g group-G adm. The root gem command creates a new user gem. the user's logon Shell is/bin/sh, it belongs to the group user group and also to the adm and root user groups. The group user group is the main group. A new group may be created here: # Adding groupadd group and adding groupadd adm to add a user account is to add a record to the new user in the/etc/passwd file and update other system files such as/etc/shadow, /etc/group. Linux provides the integrated system management tool userconf, which can be used to manage user accounts in a unified manner. 3. delete an account. if your account is no longer in use, you can delete it from the system. To delete a user account, you must delete the user record in system files such as/etc/passwd. if necessary, delete the user's home directory. The userdel command is used to delete an existing user account. the format is as follows: the common username option of the userdel option is-r, which deletes the user's home directory together. For example: # userdel sam this command deletes records of user sam in system files (mainly/etc/passwd,/etc/shadow,/etc/group, delete the user's home directory. 4. modifying an account to modify a user account is to change the user's attributes, such as the user ID, home directory, user group, and logon Shell. Use the usermod command to modify the information of an existing user. the format is as follows: usermod options common options for usernames include-c,-d,-m,-g,-G,-s, -u and-o. these options have the same meaning as the options in the useradd command. you can specify new resource values for users. In addition, some systems can use the following options:-l new user name this option specifies a new account, changing the original user name to a new user name. For example: # usermod-s/bin/ksh-d/home/z-g developer sam this command changes the logon Shell of user sam to ksh and the main directory to/home/z, change the user group to developer. 5. Management of user passwords an important part of user management is the management of user passwords. A user account has no password when it was created, but is locked by the system and cannot be used. it can only be used after a password is specified, even if it is null. The Shell command used to specify and modify the user password is passwd. Super users can specify passwords for themselves and other users. common users can only use them to modify their own passwords. Command format: passwd option options available options for the user name:-l lock password, that is, disable the account. -U password unlock. -D indicates that the account has no password. -F forces the user to change the password upon next login. If the default user name is used, modify the password of the current user. For example, if the current user is sam, the following command modifies the user's password: $ passwd Old password: ****** New password: * ****** Re-enter new password: ******* if you are a super user, you can specify the password of any user in the following form: # passwd sam New password: ******* Re-enter new password: ******** when a common user modifies his or her own password, the passwd command will first ask for the original password, and then ask the user to enter the new password twice after verification. if the two passwords are the same, specify the password to the user; when a super user specifies a password for the user, the original password is not required. For the sake of system security, you should select a complicated password. for example, you 'd better use an 8-bit long password, which contains uppercase letters, lowercase letters, and numbers, it should be different from the name and birthday. When you specify a blank password for a user, run the following command: # passwd-d sam: this command deletes the password of the user sam, the system no longer asks for the password. The passwd command can also use the-l (lock) option to lock a user so that the user cannot log on. for example: # passwd-l sam
Related Article

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.