synchronization
Some checks failed
continuous-integration/drone Build is failing

This commit is contained in:
2025-08-25 15:57:40 +08:00
commit cee91802b3
106 changed files with 9124 additions and 0 deletions

View File

@@ -0,0 +1,50 @@
> 本文作者:丁辉
# Linux中如何让目录和文件不能被删除
## 如何让文件不能删除
1. 创建文件
```bash
touch offends.sh
```
2. 添加文件属性
```bash
sudo chattr +i offends.sh
sudo chattr +i -V offends.sh
```
3. 查看文件属性
```bash
lsattr offends.sh
```
> 恢复
>
> ```bash
> sudo chattr -i offends.sh
> ```
## 如何让目录不能删除
1. 创建目录
```bash
mkdir offends
```
2. 添加目录属性
```bash
sudo chattr +i -RV offends/
```
> 恢复
>
> ```bash
> sudo chattr -i -RV offends/
> ```