Io ora sono su Ubuntu (che deriva da Debian) e il comando funziona perfettamente...
- Codice: Seleziona tutto
root@Laptop:~# chattr +i /etc/resolv.conf
root@Laptop:~# cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 62.13.169.92
nameserver 62.13.169.93
root@Laptop:~# lsattr /etc/resolv.conf
----i-------------- /etc/resolv.conf
root@Laptop:~# rm /etc/resolv.conf
rm: impossibile rimuovere `/etc/resolv.conf': Funzione non permessa
root@Laptop:~#
Ecco l'output iniziale del manuale di
chattr:
- Codice: Seleziona tutto
CHATTR(1) CHATTR(1)
NAME
chattr - change file attributes on a Linux file system
SYNOPSIS
chattr [ -RVf ] [ -v version ] [ mode ] files...
DESCRIPTION
chattr changes the file attributes on a Linux file system.
The format of a symbolic mode is +-=[acdeijstuADST].
The operator `+' causes the selected attributes to be added to the
existing attributes of the files; `-' causes them to be removed; and
`=' causes them to be the only attributes that the files have.
The letters `acdeijstuADST' select the new attributes for the files:
append only (a), compressed (c), no dump (d), extent format (e),
immutable (i), data journalling (j), secure deletion (s), no tail-merg‐
ing (t), undeletable (u), no atime updates (A), synchronous directory
updates (D), synchronous updates (S), and top of directory hierarchy
(T).
The following attributes are read-only, and may be listed by lsattr(1)
but not modified by chattr: huge file (h), compression error (E),
indexed directory (I), compression raw access (X), and compressed dirty
file (Z).
Come vedi l'opzione
i,
immutable (i), sta per immutabile, se abilitata naturalmente.
Con il comando
lsattr, come ho dimostrato sopra, si possono controllare gli attributi attivi sul file/directory in questione.