Permissions and ownership of files and directories in Linux settings
1, and vested rights to view files and directories
(1) File : Linux file access permissions, including read, write, perform three basic types, mainly for the contents of the file. Including ownership of the owner (who owns the file user account), is a group (the group that owns the account of the file). Linux system based on access to the file or directory, the home user to access process data control.
(2) Contents : Compared with the file attributes, the main access to the directory for the directory contents (including subdirectories and files in the directory under the directory)
Use "ls -l" command can show the details of the file, including permissions and ownership. For example:
As shown above, from left to right are defined as follows :
-: Indicates the file type (data file)
rw: represents the owner read and write permission
r: represents the case of group rights can be read but not write can not be executed
r: represents the rights of other users can read and write can not be executed
root: owner
root: is a group
2098: Byte Size
Permissions diagram is as follows:
2, set the file and directory permissions ------- chmod command
chmod [ugoa] [± =] [rwx] file or directory
or
chmod nnn file or directory
-R: recursively modify the permissions of all child entries under the specified directory
For example: (1) we create a abc folder, create a ab.txt abc file in the folder and in which the content is written "this is abc" of .
Permissions (2) is set ab.txt 664, that is, ordinary users can only read but not write
(3) create a normal user zhangsan, and cut to zhangsan user, save and exit into the editing interface ab.txt editing, we will find enough authority not write file.
3, attribution command sets of files and directories ------ chown
Popular formats:
chown owner file or directory
chown : is a group of files or directories
chown owner: is a group of files or directories
4, permission mask --------- umask
umaskd role: control of the new file or directory permissions
Permissions Permissions umask subtracted highest authority is the newly created file or directory
File highest authority for the 666, the highest directory permissions to 777
The default file permissions to 644, the default directory permissions to 755
For example :
1, we set umask to 000, then the permissions for the new directory abc 777.
2, set umask to 022 which is the default permissions, the new abcd directory permissions to 755.