The following examples show how to apply and display special attributes, such as immutability or read-only access, to ZFS files.
For more information about displaying and applying special attributes, see ls(1) and chmod(1).
Use the following syntax to make a file immutable:
# chmod S+ci file.1 # echo this >>file.1 file.2: cannot create # rm file.1 rm: file.1: override protection 644 (yes/no)? yes rm: file.1 not removed: Not owner |
You can display special attributes on ZFS files by using the following syntax:
# ls -l/c file.1 -rw-r--r-- 1 root root 206674 Jul 31 10:52 file.1 {A-----im--} |
Use the following syntax to remove file immutability:
# chmod S-ci file.1 # ls -l/c file.1 -rw-r--r--+ 1 root root 206674 Jul 29 10:27 file.1 {A------m--} # rm file.1 |
The following example shows how to apply read-only access to a ZFS file.
# chmod S+cR file.2 # echo this >>file.2 file.2: cannot create |
You can display all special attributes with the following syntax:
# ls -l/v file.3 -r--r--r-- 1 root root 206674 Jul 31 11:30 file.3 {archive,nohidden,noreadonly,nosystem,noappendonly,nonodump,immutable, av_modified,noav_quarantined,nonounlink} # chmod S+cR file.3 # ls -l/v file.3 -r--r--r-- 1 root root 206674 Jul 31 11:30 file.3 {archive,nohidden,readonly,nosystem,noappendonly,nonodump,immutable, av_modified,noav_quarantined,nonounlink} |
Some of these attributes only apply in a CIFS environment.
You can clear all attributes on a file. For example:
# chmod S-a file.3 # ls -l/v file.3 -r--r--r-- 1 root root 206674 Jul 31 11:30 file.3 {noarchive,nohidden,noreadonly,nosystem,noappendonly,nonodump,noimmutable, noav_modified,noav_quarantined,nonounlink} |