Access to UNIX files and directories can be viewed as a 3*3 matrix.
That is, three access objects (owner, groups, and others are the owner, user group, and others). Each object has three access permissions (read, write, and execute ).
The Binary Expression of 111 means 7,100 is 4. If you make it readable or writable, it means 110 (6), you can use the LS-l command to view the permission settings of files or directories, the second to tenth characters in the output. These nine characters indicate three access permissions for each of the three user types.
-RW-r -- 1 sathiya 272 Mar 17 test.txt in the above example: * The user is the owner (sathiya) with read and write permissions (r indicates read, W indicates write, X represents execute [Translator's note])
* Other users in the user group have the read permission. * Other users have the read permission:
* Read: has the permission to read the file content * write: has the permission to write to the file * execute ): three directory access permissions are granted to execute files as programs or scripts: * read: Read Permission to read directory content (display files and subdirectories under this directory ).
* Write: You have the permission to write to the directory (create files and subdirectories under this directory) * execute: You have the permission to open this directory (read ), the number of write and execute permissions indicates: * read (read) 4 * write (write) 2 * execute (execute) 1 if you want to get a combination of Multiple permissions, you only need to add the corresponding values.
For example, if you need read and write permissions (read and write), 4 + 2 = 6. Use chmod to change the permissions of a file or directory. You can use an octal digit or character to change the permissions of a file or directory. Octal representation of permissions (from left to right): * first digit for owner * Second digit for user group * Third digit for other users if owner) read and Write (read 4, write 2, 4 + 2 = 6) permissions, and grant read 2 permissions to user groups and other users (Others: $ chmod 644 file name if you want to grant the owner (owner) read and execute (read
4, execute + 1 = 5) permission, and grant the user group (group) read (read 4) permission, and grant other users no permission (0 ): $ chmod 540 if you want to grant the owner the read and write permissions (read 4, write 2, 4 + 2 = 6) and the user group zero permissions (0 ), and grant other users read (read 4) permissions: $ chmod 604 file name umask 022 represents the default permission for a file. The default umask value is 0022, this value indicates the default permissions of a new file or directory.
The default permission for a directory is 0777, and the default permission for a file is 0666. The permission for creating a file or directory is the default permission minus the umask value of 0022.
The default file permission calculation method is as follows: * default file permission: 666 * default umask value: 022 * default final File Permission: 644 default directory permission calculation method: * default directory permission: 777 * default umask: 022 * Final default directory permission: 755 you can change umask to the required value based on the above calculation method. For example, if you want anyone other than the owner to have zero (0) permissions on files or directories, you can set the umask value to 0077.
$ Umask 0077 then, If you create a new file or directory, the user has the following permissions: $> testfile $ LS-l testfile-RW ------- 1 sathiya 0 Mar 17 08:23 testfile
Address: http://bbs.weiphone.com/read-htm-tid-1311002.html