1.linuxdirectory Structure
1) the directory composition class of the Linux system is intended to be an inverted tree structure that begins to extend downward with a directory named root ("/").
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/58/DD/wKioL1S_PISh9GC8AACewzp-dkg625.jpg "title=" 1.png " alt= "Wkiol1s_pish9gc8aacewzp-dkg625.jpg"/>
2) It differs from other operating systems. For example, Windows , how many partitions there are in Windows, and how many of them are tied together, and in Linux no matter how many partitions have a root.
3) The corresponding file type character in the Linux system is "D".
The following two special directories exist in each directory of Linux
"." represents the current directory.
" . "represents the parent directory
4) directory is a special kind of file
Read and write execution permissions on the directory are different from normal files.
READ: Users can read files in the directory
Write: Use alone does not work. It is used in conjunction with Read and Execute permissions to add and delete any file within the directory.
Execution: The user can enter the directory, call the directory information
2.linuxCommon directory Structure
/ Boot : Storage core, module image and other startup files
/ Dev : storage device Files
/bin : Stores common user directives.
/ etc : Storage System, service configuration directory and file
/Home : Store personal home directory
/lib : Repository files, such as core modules, drivers
/lost+found : Storing the orphan files for fsck
/mnt : Common mount points used by the system to load the file system
/opt : Installation directory used by third-party tools
/proc : Virtual file system with system core information
/root : Root user's home directory
/sbin : Instructions for storage System Management
/ tmp : Staging point for temporary files
/ usr : Storing files and directories directly related to the user
/ var : Storage of data that may change during system run
3.mandatory bit and adventure bit
3.1 Description:
1) in Linux system files in addition to read and write execution permissions,the EXT4 file system also supports the mandatory bit (setuid ,setgid) and adventure bit (sticky) Special permissions.
2) for the file creator can add mandatory bit (setuid), file group can also add the mandatory bit (setgid), for other users can add the adventure bit (sticky).
3) The force bit and adventure bit are added atthe location of the Execute permission (x). If the execution permission is already at that location , the force bit is represented in the case of the adventure bit in lowercase letters (s or t), Otherwise, in uppercase letters (s or t) .
Example: If the file's permission is "rwxr-r-x", then the new permission is "Rwsr-sr-t" if the mandatory bit and adventure bit are set
3.2 sets the mandatory bit for the creator.
1) set the mandatory bit setuid for the creator , which is generally for instructions in a system.
2) By default, the user executes an instruction that runs as the user's identity.
3) when the executable file for an instruction is set (setuid), any user executing the file will execute the file as the creator of the executable file corresponding to the instruction.
syntax:chmod u±s< file name >
Example:chmod u+s/bin/ls
3.3 to set a mandatory bit on a group
1) set the mandatory bit setgid forthe group, which is generally for a directory.
2) By default, the group of files or subdirectories that a user creates in a directory is the user's primary group.
3) If you set the mandatory bit of a group to a directory, any files or subdirectories created by any user in this directory will inherit the group of this directory (provided that the user has permission to create files or subdirectories in the directory).
syntax:chmod g±s < catalogue >
Example:chmod g+s/dir
3.4 set an adventure bit for other users
1) set the adventure bit sticky for other users , which is usually for a directory.
2) By default, if a directory has R,W, and x permissions for the user , the user can create and delete any file in this directory.
3) Once the adventure bit is set on the directory, it means that only the owner of the file, the owner of the directory, and the system administrator can delete the file in the directory.
3.5 to set permissions by number
1) The user can use the chmod command to set the mandatory bit and adventure bit for the file.
setuid : chmod u+s file name
Setgid : chmod g+s directory name
Sticky : chmod o+t directory name
2) mandatory and adventure bits can also be added by a number and placed before the three digits of the read and write execution
4 (setuid)
2 (Setgid)
1 (Sticky)
Example: To set a file as "RWS r-x r-x" , you can use the following directive:chmod 4755 < file name >
4.umaskMask
1) This file will have default permissions when each user establishes a file.
2) the value of the default permission is determined by the Umask value in the environment and the cardinality of the file and directory.
3) the user can change the umask value independently and take effect immediately after the change.
4) the default Umask value for the average user is 002, and the default Umask value for the system user is 022.
5) the base of the file: 666; The base of the directory: 777
This article is from the "Study-everyday" blog, make sure to keep this source http://studys.blog.51cto.com/9736817/1606560
Introduction to the Linux directory structure and mandatory bit, adventure bit