There are some caveats when the Linux system deletes files. If you don't notice these details, you can't delete files even if you have the w permission for a file. Here's a concrete demonstration of the scene of deleting files, to show you why the Linux system has w permissions but can not delete files.
Scene Simulation:
root User
[root@mode-6 ~]# mkdir /oldboy/
[root@mode-6 /] # ll /oldboy/-d
drwxr-xr-x 2 root root 4096 Nov 27 15:46 /oldboy/
[root@mode-6 ~]# cd /oldboy/< Br>
[root@mode-6 oldboy]# vim test1.sh
echo ‘My name Is ZhangLiang.’
[root@mode-6 oldboy]# ll
total 4
-rw-r--r-- 1 root root 30 Nov 27 15:44 test1.sh
Ordinary users
[ Oldboy@mode-6 oldboy]$ cat test1.sh
echo ‘My name Is ZhangLiang.’
[oldboy@mode-6 oldboy]$ echo “12312” 》 Test1.sh
-bash: test1.sh: Permission denied # Insufficient permissions
[oldboy@mode-6 oldboy]$ . /test1.sh
-bash: . /test1.sh: Permission denied# Insufficient permissions
root user
[root@mode-6 oldboy]# chmod 747 test1.sh
[root@mode-6 Oldboy]# ll
total 4
-rwxr--rwx 1 root root 30 Nov 27 15:44 test1.sh
This is a rwx operation with other users Can be successfully executed. However, it fails when deleting.
[oldboy@mode-6 oldboy]$ rm -f test1.sh
rm: cannot remove `test1.sh‘: Permission denied # Permission denied < Br>
The file name is saved in the block of the parent directory, so whether the file can be deleted depends on whether the upper directory has the corresponding w permission.
[root@mode-6 /]# ll /oldboy/-d
drwxr-xr-x 2 root root 4096 Nov 27 15:46 /oldboy/# Other users do not have w permission . So you can't delete
[root@mode-6 /]# chmod 757 . /oldboy/# root user
[root@mode-6 /]# ll /oldboy/-d
drwxr-xrwx 2 root root 4096 Nov 27 15:46 /oldboy/# Permissions Modified
[oldboy@mode-6 oldboy]$ rm -f test1.sh # Normal user can be successfully deleted
############## ################################################################################################## #####br>
################################################################################## Said rwx
where r: represents the contents of the read directory
w: delete, modify the permissions of the file name in the directory [must be executed with x]
x : Can the representative enter the directory?
Through the above demonstration, do you know why the Linux system has the w permission but cannot delete the file? After reading this article, you can avoid the same problem the next time you delete a file.
sleep, meaning sleep, in the Linux system, the sleep command is mainly used to dela
Lynis is an auditing tool in Linux system that can detect the security of Linux sys
Sometimes Linux users will find that they cannot start when they start the system.
In the Ubuntu system operation, after compiling Nox and installing make error, what
How to use Linux to periodically delete expired files using the command
Ubuntu install Nvidia Optimus driver steps
How to implement multi-window operation on Linux on Linux
How to use the top command to monitor Linux system performance
How to install virtualization tools in Linux llibvirt
Linux recovery root password two methods
Linux tips for using FDisk tools
What should I do if ssh is slow to connect to other Linux machines?
Ubuntu removes the emulator failure prompt "the android "XXX" virtual solution
Linux offline query dictionary method
How to use the access control list to limit user permissions under Linux
The simplest way to access XP in Windows 7 in LAN
Starting windows time long win7/8.1 solution
Windows 7 IIS installation and configuration tutorial
New Win9 concept interface diagram: beautiful degree spike Win8
Win10 built-in killing Windows Defender how to remove from the right-click menu?
WINXP boot often shows pink and can recover into the system
Expert Tips: How to find out where data center vulnerabilities are located
Win8.1 IE11 can bring extraordinary streaming video function