Tips:
The user here refers to the normal user read and write execution permissions to root invalid
For catalogs,
1) Only Read permission can see the contents of the directory LS, cannot switch into the directory and can not create directories or files
[[email protected] opt]$ ls log/
Ls:cannot Access Log/www:permission denied
Www
[Email protected] opt]$ CD log/
-bash:cd:log/: Permission denied
[Email protected] opt]$ mkdir log/aa.txt
Mkdir:cannot Create directory ' Log/aa.txt ': Permission denied
2) Only write permission can neither LS view directory contents, nor switch into the directory to create a directory or file
[[email protected] opt]$ ls log/
Ls:cannot Open Directory log/: Permission denied
[Email protected] opt]$ CD log/
-bash:cd:log/: Permission denied
[Email protected] opt]$ mkdir log/aa.txt
Mkdir:cannot Create directory ' Log/aa.txt ': Permission denied
3) Only execute permission cannot view directory contents, can switch into directory but cannot create directory or file
[[email protected] opt]$ ls log/
Ls:cannot Open Directory log/: Permission denied
[Email protected] opt]$ CD log/
[[email protected] log]$ ls
Ls:cannot Open Directory.: Permission denied
[Email protected] log]$ CD.
[Email protected] opt]$ mkdir log/aa.txt
Mkdir:cannot Create directory ' Log/aa.txt ': Permission denied
4) have read and Write permissions can view directory content ls, cannot switch into the directory or create a directory or file
[[email protected] opt]$ ls log/
Ls:cannot Access Log/www:permission denied
Www
[Email protected] opt]$ CD log/
-bash:cd:log/: Permission denied
[Email protected] opt]$ mkdir log/aa.txt
Mkdir:cannot Create directory ' Log/aa.txt ': Permission denied
5) Permission to write execute cannot view directory contents, can switch into directory or create directory or file
[[email protected] opt]$ ls log/
Ls:cannot Open Directory log/: Permission denied
[Email protected] opt]$ CD log/
[[email protected] log]$ ls
Ls:cannot Open Directory.: Permission denied
[Email protected] log]$ CD.
[Email protected] opt]$ mkdir log/aa.txt
6) have read execution permissions can view directory content ls, you can switch into the directory, but cannot create directories or files
[[email protected] opt]$ ls log/
Aa.txt www
[Email protected] opt]$ CD log/
[[email protected] log]$ ls
Aa.txt www
[Email protected] log]$ RM-RF aa.txt/
Rm:cannot remove ' aa.txt/': Permission denied
For a file,
1) only Read permission can cat view content, can not look at the file to add content
[email protected] log]$ cat Test.log
[Email protected] log]$ echo 1111 > Test.log
-bash:test.log:permission denied
2) Only write permission cannot cat view the contents of the file, but can add content to the file
[email protected] log]$ cat Test.log
Cat:test.log:Permission denied
[Email protected] log]$ echo 1111 > Test.log
3) Only execute permission can execute the file
4) Read and Write permission to view the contents of a file or to add content to a file
[email protected] log]$ cat Test.log
1111
[Email protected] log]$ echo > Test.log
[email protected] log]$ cat Test.log
5) Permission to write does not allow cat to view the contents of the file, but can add content to the file and execute the file
[Email protected] log]$ echo 1111 > Test.log
[email protected] log]$ cat Test.log
Cat:test.log:Permission denied
6) have read Execute permission can cat view the contents of the file and execute the file, but not add content in the previous file
[email protected] log]$ cat Test.log
1111
[Email protected] log]$ echo > Test.log
-bash:test.log:permission denied
Summarize:
For catalogs,
You can view the contents of the directory with the Read permission alone, but you cannot switch the CD into the directory.
Have write permissions alone nothing can do neither LS view directory contents, nor can you switch to directory to create directories or files
Individual Execute permissions can switch the CD into the directory, but not LS view directory contents and create files or directories
Have read execute permission, can view directory contents of LS can be switched into the directory CD
Permissions with write execution can be switched to the directory by CD, can create files or directories
Permission to read and write LS to view the contents of the directory, not to switch into the directory or to create a directory or file
For a file,
Cat can view the contents of a file with Read permission alone
Separate write permissions to add content to a file just can't see what's added
Have execute permissions separately if the file is a binary file that can execute the file
With read execution permission, cat can view the contents of the file and execute the file, but not add content to the previous file
Permission to write does not allow cat to view the contents of the file, but can add content to the file and execute the file
Permission to read and write allows cat to view the contents of a file or to add content to a file
The impact of Linux read and write execution permissions on directories and files