6.linux User and permission creation

Source: Internet
Author: User
Tags file permissions

I. Establishment of users and permissionsSU user name Switch user, if the root user switch other users, do not need to enter a password. exit to switch back to the previous userWhat are the types of Linux operating system users? administrator: Root user uid value 0Normal User: UID 500 to 60000 can be logged into the system/binprogram User: UID 1-499 can not log on to the system when the program starts to call the user's permissions, can only give the program user permissions/etc/passwd record information for all users in the systemRoot:x:0:0:root:/root:/bin/bashField 1: User nameField 2: Password placeholderfield 3:uid valueField 4: User's base Group ID valueField 5: User Information record column phone address full name, etc. informationField 6: User's home directoryField 7: Command interpreter shell used by user login /etc/shadow Record The password information of all users in the system,root:$6$nstjdwa7r6a5alak$ft4fozaeizzyc38y0jrxq85j:17465:0:99999:7 :::Field 1: User nameField 2: Password after encrypting with sha-512Field 3: Distance from January 1, 1970 password Most recent modification time number of daysField 4: Minimum password validity ajest 5 No change of password within 5 daysfield 5: Maximum password duration ajest 90 90 days for the password to be usedField 6:7-day reminder before password expiresField 7: Inactive period after password expiresField 8: Expiration time for users from January 1, 1970/etc/group Record All group information in the systemall users in a Linux system must have a basic group, and users can have multiple additional groupsroot:x:0:Field 1: Group nameField 2: Password placeholders for groupsField 3:gid numberField 4: The user's additional group is the root group and the user name is displayed to the fieldtwo. How to set up users, how to modify user properties, how to establish user passwords, how to set up groups, modify group information. How to create a useruseradd "Options" user name-U number Specifies the UID number of the user-G Group name specifies the user's base group-G Group name specifies the user's additional group-M does not establish a user's home directory-S login shell for the specified userCreate a program user named game that requires the UID to beuseradd-u 55-s/sbin/nologin-m gameset up a user named Allen, requiring its base group to be the root group for the Ajest group, with the UID number 510useradd-u 510-g ajest-g Root Allenthree. How to modify user Propertiesusermod [Options] User name modify user information-u-g-g-s is equivalent to Useradd function- l Lock User- u Unlock userModify the UID of the Allen User 505 Base Group is the root group, the additional group is the Ajest groupusermod-u 505-g root-g ajest Allenfour. How to create a user passwordpasswd User Name- s View user password status userdel-r User Name-R Delete user home directory and all information in/var directoryGroupadd [options] Group name new group-G GID for the specified groupgroupmod [Options] Group name modify group information- g Modify GIDGroupdel Group name Delete groupgpasswd-a User name Group nameadd a user to a group (is the user's add group) gpasswd-d User name Group nameremove a user from a groupFive. Permissions for a file or directoryDrwxr-xr-x. 3 root rootd rwx r-x r-xField 1: File type D directory-normal file L Symbolic Link file B-block device C-character deviceField 2: Permissions for file ownersCommon File | Cataloguer: Read File | Listing Directory Contentsw: Edit File | You can add delete filesx: Execute File | Can enter this directoryField 3: Permissions for the group to which the file belongsField 4: Permissions for other users3-----Number of subdirectories in the directorythe owner of the root filethe owning group of the root file chmod modifying file Permissionschmod object operator permissions file or directoryExample: chmod go-w/shareobjects are divided into U (user-owned) G (Group-owned groups) O (other users) a (all)operator: + 、-、 =Permissions: R W X-(No permissions)
 8 binary weightingr=4 w=2 x=1chmod-r 777 Directory recursively attaching all files in the directory including the directory itselfchown Modify the file's ownerChgrp Modifying the owning group of a file- R recursive weightingSix. Advanced usage of permissions adhesive bit setting Sgid setting suid settingSticky bit: Specifies the role of the directory, where the directory has write permissions, only the creator can delete their own files. (Root is unaffected by this)chmod o+t Directorychmod 1777 Catalogue sgid: Specifies a directory in which the owning group of files or directories established in the directory inherit from the owning group of that directorychmod g+s Directorychmod 2777 Cataloguesuid: Specifies the executable or command file that executes the file or command, and whose permissions are executed according to the permissions of the owner of the current file or command. chmod u+s Commandchmod 4755 CommandHow to set the Access control list for a file setfacl-m u: User name: Permission file or directorysetfacl-m G: Group name: Permissions file or directorygetfacl file or directory viewsetfacl-x u: User name file directory

6.linux User and permission creation

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.