Linux file Type file permissions

Source: Internet
Author: User
Tags file type file readable

common types of files in Linux are:"-" means normal file:-rw-r--r--1 root root 41727 07-13 02:56 install.log"d" means directory: Drwxr-xr-x 2 root root 4096 07-13 03:18 Desktop "B" represents a block device file: Brw-r-----1 root disk 8, 0 07-13 05:57/DEV/SDA "C" means the character device file: Crw-rw-rw-1 root TTY 5, 0 07-13 05:58/dev/tty "l" means symbolic Link: lrwxrwxrwx 1 root root 07-13 02:09/etc/rc.local-rc.d/rc.local Linux file permissions:The file has a total of nine permission flags, divided into 3 groupsrepresents the permissions of the owner of the file, the permissions of the user group to which the file belongs, and the permissions of other users  There are three kinds of permissions for files:* Readable (R): means we can view reading;* Writable (W): means that it can be modified or deleted (although the permissions removed or modified are controlled by the permissions on the parent directory);* Executable (x): means that a file can be run, such as a binary file (such as a command), or a script (to interpret a run with a scripting language interpreter). There are two ways to set and change directory and file permissions by command chmod1, through the eight-binary syntax2, mnemonic grammaroctal Syntax: Octal syntax uses numbers to indicate that each permission is R (4), W (2), X (1),-(0)drwxrwxr-x 2 User user 4096 07-13 15:17 SDKr+w+x = 7 r+w+x =7 r+-+x = 5octal number to represent the permissions of the file, which should be 775   Modify the permissions of the Directory SDK to: The master-to-directory SDK has readable and writable executable permissions, and the group and others have readable and executable permissions [[email protected] ~] #chmod 755 SDK #修改权限为755   [email protected] ~]# ls-l #修改后验证Total 4 drwxr-xr-x 2 user user 4096 07-13 15:17 SDKIf you want to modify permissions for all files in both the directory and subdirectories, execute the following command:  [[email protected] ~] #chmod –R 755 SDK in the mnemonic syntax, the owner (user) is represented by the U, the group uses the G representation, and other users (other) use O to denote, while everyone (all) uses a to represent.  use "+" to indicate that the add permission, "-" means the reduced permission, and "=" represents the granted permission. of course, use R, W, x to represent permissions. When used, it can be used in combination. < Span style= "FONT-FAMILY:CALIBRI;" > /span>       [email protected] tmp]# Touch Xifeng #创建空文件[[email protected] tmp]# chmod u+x Xifeng # Add Execute permission to the owner of the file[[email protected] tmp]# chmod go-r Xifeng # Subtract Read permissions from the genus and other users of the file[[email protected] tmp]# chmod a-rwx Xifeng # Everyone denies access[[email protected] tmp]# chmod A+RW Xifeng # Everyone has read and write access[email protected] tmp]# chmod o=rw #其它人的权限为读写drwxrwxr-x 2 user user 4096 07-13 15:17 SDKnumber of hard Links This value changes when you create a hard link in a file drwxrwxr-x 2 user user 4096 07-13 15:17 SDKthe owner of the fileIt means that the file is the user's. This is the directory for user users. You can modify the owner of a file or folder by chown [[email protected] ~] #chown root/home/user/qiuri #使用命令修改属主 [email protected] ~]# ls-l/home/user #验证修改结果Total 4 drwxrwxr-x 2 root user 4096 07-13 15:17 SDKdrwxrwxr-x 2 root user 4096 07-13 15:17 SDKGroup of file generaModify a file or folder group user by command chgrp[[email protected] ~] #chgrp root/home/user/sdk#修改文件属组, similarly, if you want to modify the current directory and subdirectories, use the option-R. [email protected] ~]# ls-l/home/user #验证结果Total 4drwxrwxr-x 2 root root 4096 07-13 15:17 SDK drwxrwxr-x 2 root root 4096 07-13 15:17 SDKthe size of the file, here is 4096 bytesdrwxrwxr-x 2 root root 4096 07-13 15:17 SDKCreate or modify the time, here is the 7 month : Changes to this value are related to modification or access to the file. drwxrwxr-x 2 root root 4096 07-13 15:17 SDK the name of the file or directoryWhen we modify the owner and the group of the file, we can use the command to modify it at the same time:[[email protected] ~] #chown Root.root/home/user/xifeng#同时修改文件的属主和属组, if you want to modify all file properties under directories and subdirectories, use the option-R. [email protected] ~]# ls-l/home/user #验证结果Total 4 drwxrwxr-x 2 root root 4096 07-13 15:17 jdkReference: http://baidu.blog.51cto.com/71938/107682

Linux file Type file permissions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.