1. In Linux, any file has the "User, group and others" three identities of individual permissions.
Take Wang Sanmao as an example, Wang Sanmao This "file" user is Wang Sanmao, he belongs to Wang Damao This group, and Zhang Piglet relative to Wang Sanmao, is only a "others" just. The omnipotent God is root.
In our Linux system, by default, all the accounts on the system and the general identity user, as well as the root information, are recorded in the/etc/passwd file. As for the individual's password, it is recorded under the/etc/shadow file. In addition, all Linux group names are recorded in/etc/group!
2. Linux file properties
after logging into Linux as root, enter "Ls-al", LS is list, to display the file name and related properties, and the option "-al" means to list all the file's detailed permissions and attributes
- The first column represents the type and permissions of this file (permission):
① The first character represents the properties of this file: [ D ] is a directory, [ - ] is a file, [ l ] is indicated as a Nexus file (Linkfile), similar to a shortcut, [ b ] is indicated as a storage interface in the appliance file [ C ] is a serial port device in the device file, such as a keyboard, mouse (one-time reading device), [ P ] is a data transfer file; [s] is a data interface file.
② the next character, three is a group of three parameter combinations that are "rwx". [R] stands for readable (read), [W] for writable (write), [x] for executable (execute), [-] for no permissions. Altogether three groups, respectively, correspond to user,group,others.
- The second column indicates how many file names are linked to this node (I-node):
Each file name is linked to the i-node of a filesystem, and this property records how many different file names are linked to the same i-node number.
- Column Six is the date the file was created or the most recent modification date:
The "ls-l--full-time" command can show the full time format
- The seventh column is the file name
The hidden file is the first character of the file name is ". "The File
The importance of Linux file permissions: The system protects the function, the team develops the software or the data to share the function, does not have the privilege to set up the harm.
3. Changing file properties and Permissions
- R indicates that you want to connect all secondary directories or files under the directory
- chmod: Features that change file permissions, SUID, SGID, Sbit, and so on
① Number Types Change file permissions: R:4 w:2 x:1
② symbol types Change file Permissions : U (User), G (Group), O (ohters), A (all)
the importance of permissions on the file: R forreading the contents of the file, W for write/edit/Add/modify, but not the ability to delete the file itself; X determines whether the file can be executed x, which represents only the capability that can be executed, does not mean that it can be executed successfully.
The importance of permissions to the directory: the file holds the actual data, and the directory is the list of record files. R represents the ability to read a list of directory structures and does not imply access to the directory; W represents the permissions (new, deleted, renamed, moved) that have the list of the directory structure to be changed; X determines whether the user can enter the directory as a working directory (work directory is your current directory) Only r no X can read only the list of directory file names, the details are not visible, all are question marks.
4. Linux file types and extensions
① File type: regular files (regular file) [-]: Plain text file (ASCII), binary binary (binary) data format files (directory) [d]; link file [l]: Shortcut Equipment and device file (device) [B]: block (block) device file, character (character) device files, data interface file (sockets) [s], data transfer file (FIFO, pipe) [P].
②linux file extension: *.sh: script or batch file (scripts); *z, *.tar, *.tar.gz, *.zip, *.tgz: Packaged compressed file *.html, *.php: web-related files.
③linux file Length limitation: when using a preset ext2/ext3 file system, the maximum allowable file name for a single file or directory is 255 characters and the full file name of the full path name and directory (/) is 4,096 characters.
④ Linux file name limitations: It is best to avoid special characters when setting filenames: *?> <; &! [ ] | \ ' "' () {}
< six > Linux file permissions and directory configuration