Linux basics: Linux user basics

Source: Internet
Author: User
Linux basics: Basic users of Linux users. when using Linux, users must run as one user. Users can restrict the resources that users or processes can use or cannot use. Group to facilitate organization and management. each user has a UserID, which is actually used by the operating system... linux basics: Basic users of Linux users. when using Linux, users must run as one user. Users can restrict the resources that users or processes can use or cannot use. Group, which is used to facilitate organization and management. each user has a UserID. the operating system actually uses the user ID instead of the user name. each user belongs to a main group, each group belongs to one or more affiliated groups and each group has a GroupID. each process runs as one user, and restricted by the resource that the user can access, each logged-on user has a set shell user ID of 32 bits, starting from 0, but in order to be compatible with the old-fashioned system, the user ID is limited to less than 60000. Users can be divided into the following three types: root users (users with ID 0 are root users) system users (1 ~ 499) common users (more than 500) all files in the system have a user and group. use the id command to display information of the current user. use the passwd command. you can modify the password of the current user./etc/passwd-save the user. information/etc/shadow-save user password (encrypted) /etc/group-save group Information View logon user command whoami show current user command who show which users have logged on to System Command w show which users have logged on and what pts/0: in Gui Linux, the longer the command is, the less the command is displayed, the more you create a user command useradd create a new user $ useradd zsd create a user named zsd this command will execute the following operations 1. add user information in/etc/passwd. if passwd command is used to create a password for the specified user, the password is encrypted and stored in the/etc/shadow file. 3. create a new home directory for the user/home/ Zsd4. copy the files in/etc/skel to the user's home directory (this file is the initial file of the new user, and creates some files in this file, such as user documents, these files will be automatically available after new users are created.) 5. create a group with the same user name, by default, the new user belongs to the group with the same name command useradd. the following parameters are supported:-d home directory-s logon shell-u userid-g main group-G affiliated group. you can also directly modify/etc/passwd, however, it is not recommended to modify the usermod parameter of user information. the usermod command supports the following parameter-l new user name. $ Usermod-l new_name test_user rename test_user to new_name (after the new user name is modified, the user file name in the/home directory will not change and must be manually modified; otherwise, the user cannot find the home directory after logon) -u new userid. $ Usermod-u 1002 test_user change the test_user id to 1002-d user's home directory location-g user's main group-G user's affiliated group-L locking user so that it cannot log on-U unlock the delete user command userdel is used to delete the specified user $ userdel test_user (delete a user, but keep the user's home directory) $ userdel-r test_user (delete the user and delete the user's home directory). almost all operating systems in the group have the concept of group, we can classify and manage users more conveniently. Generally, you can create a group by department, function, or geographical region. Each group has a group ID. The group information is saved in/etc/group. each user has a primary group, and a maximum of 31 affiliated groups can be created and modified, delete group command groupadd to create group $ groupadd lab104 command groupmod to modify group information $ groupmod-n newname oldname modify group name $ groupmod-g newGid oldGid modify group ID command groupdel to delete group $ groupdel lab104
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.