2016-02-16 13:44:30 +05:30
|
|
|
# chattr
|
|
|
|
|
2019-02-11 19:00:49 +01:00
|
|
|
> Change attributes of files or directories.
|
2021-07-09 16:45:55 +02:00
|
|
|
> More information: <https://manned.org/chattr>.
|
2016-02-16 13:44:30 +05:30
|
|
|
|
2025-06-28 12:46:55 +03:00
|
|
|
- Make a file or directory [i]mmutable to changes and deletion, even by superuser:
|
2016-02-16 13:44:30 +05:30
|
|
|
|
2019-02-08 01:31:19 +01:00
|
|
|
`chattr +i {{path/to/file_or_directory}}`
|
2016-02-16 13:44:30 +05:30
|
|
|
|
2019-02-08 01:31:19 +01:00
|
|
|
- Make a file or directory mutable:
|
2016-02-16 13:44:30 +05:30
|
|
|
|
2019-02-08 01:31:19 +01:00
|
|
|
`chattr -i {{path/to/file_or_directory}}`
|
2016-02-16 13:44:30 +05:30
|
|
|
|
2025-06-28 12:46:55 +03:00
|
|
|
- [R]ecursively make an entire directory and contents immutable:
|
2016-02-16 13:44:30 +05:30
|
|
|
|
2019-02-11 19:00:49 +01:00
|
|
|
`chattr -R +i {{path/to/directory}}`
|
2025-06-05 05:36:18 +03:00
|
|
|
|
|
|
|
- Mark a directory and its files to be interpreted in a case-insensitive manner:
|
|
|
|
|
|
|
|
`chattr +F {{path/to/directory}}`
|
|
|
|
|
2025-06-28 12:46:55 +03:00
|
|
|
- Set a file to only allow [a]ppending:
|
2025-06-05 05:36:18 +03:00
|
|
|
|
|
|
|
`chattr +a {{path/to/file}}`
|