Solution to rm: cannot remove '.user.ini': Operation not permitted

888u

Last update at :2023-12-28,Edit by888u

If you also build a website based on LNMP, a .user.ini file will be automatically generated in each website directory to prevent cross-directory access and cross-directory file reading. If we try to delete this file, a message of insufficient permissions will be returned: rm: cannot remove ‘.user.ini’: Operation not permitted. Below we will share the reasons and solutions.

1. Introduction to Linux file attributes

Linux files or directories have a total of 8 attribute modes:

We can use the lsattr .user.ini command to view the file mode of .user.ini. We can see that .user.ini is in i mode, that is, "files or directories must not be changed arbitrarily":

If we try to delete .user.ini, an insufficient permission error will be returned (rm: cannot remove ‘.user.ini’: Operation not permitted):

2. How to delete .user.ini

If we want to delete .user.ini, we need to first remove the i mode of .user.ini, that is, modify the .user.ini permissions. The command is as follows:

chattr -i .user.ini

Try to delete .user.ini later and it will be deleted successfully.

Recommended site search: free domain name, free trial of virtual space, US high-defense space, telecommunications hosting, website space application, corporate virtual host, US imitation brand space, Internet cafe IP address query, independent IP host, dynamic IP dial-up server ,

Solution to rm: cannot remove '.user.ini': Operation not permitted

All copyrights belong to 888u unless special state
取消
微信二维码
微信二维码
支付宝二维码