Example:-rw-r--r--1 root root 42304 Sep 4 18:26 Install.log
#第一个字符代表这个档案是 "directories, files, or linked files, etc.":
When [d] is the directory, for example, the row with the table file named ". GConf";
When [-] is the file, for example, the previous table is named "Install.log" the line;
If [l] is indicated as a link file (link file);
If [b] means OU (random access device) for the available storage interface in the device file;
If [C] is indicated as a serial port device inside the appliance file, such as a keyboard, mouse (one-time reading device).
#下面的字符3个为一组, a combination of three parameters for "rwx"
[R] stands for readable (read), [W] for writable (write), [x] for executable (execute).
Note that the position of the three permissions does not change, and if there is no permission, it is indicated by a minus sign [-].
The first group is "permissions for the file owner"
The second group is "permissions for the same group"
The third group is "permissions for other non-groups"
#第二栏表示有多少档名连结到此节点 (I-node)
The third column represents the "owner account" of this file (or directory)
Column four indicates the group to which this file belongs.
Column five for the size of this file, the default unit is bytes
Column Six is the date the file was created or the date it was last modified.
The seventh column is the file name for this file.
Changing file properties and Permissions
#chgrp: Change the group to which the file belongs
Change group, the names of the groups to be changed must exist within the/etc/group file
Example: Chgrp users Install.log
#chown: Change the file owner
Change owner, the user must be an existing account in the system, that is, in/etc/passwd this file has a record of the user name
Example: Chown bin Install.log
#chmod: Features that change file permissions, SUID, SGID, Sbit, and so on
1, the number type changes the file permissions. R:4, W:2, x:1
Each identity (owner/group/others) of the respective three permissions (r/w/x) value is required to accumulate, for example, when the permission is: [-rwxrwx---] is: Owner = rwx = 4+2+1 = 7, group = RWX = 4+2+1 = 7, others=---= 0+0+0 = 0
Example: chmod 770. BASHRC
2, the symbol type changes the file permissions. U=user, G=group, O=others, A=all
Example: "-rwxr-xr-x", chmod u=rwx,go=rx. BASHRC
"-rwxr-xr--", chmod u=rwx,g=rx,o=r. BASHRC
Add. BASHRC Write permissions for everyone in this file, chmod a+w. BASHRC
Remove. BASHRC Write permissions for everyone in this file, chmod a-w. BASHRC
The meaning of the permission on the file:
R (Read): Can read the actual contents of this file, such as reading the text file content, etc.;
W (write): You can edit, add, or modify the contents of the file (but you cannot delete the file);
X (EXecute): The file has permissions that can be executed by the system.
The meaning of permissions on the directory:
R (Read contents in directory):
Represents a permission to read a list of directory structures, so when you have read (r) permissions for a directory, you can query the file name data under that directory. So you can use the LS command to display the table of contents of this directory!
W (Modify contents of directory): This writable permission to the directory he represents that you have permission to change the list of the directory structure, which is the permissions below:
o Creation of new archives and catalogues;
o Delete files and directories that already exist, regardless of the permissions of that file! )
o Renaming an existing file or directory;
o Move files and directory locations within the directory.
X (Access directory): directory can not be executed, the directory of X represents the user can enter the directory to become a working directory for the purpose! The so-called working directory is the directory where you are now! For example, when you log in to Linux, your home directory is your current working directory. And the instructions for transforming the directory are "CD" (Change directory)
Linux Learning -03-file and directory permissions-1