Сравнивайте с английским: нажмите на абзац — оригинал откроется в окне. Кнопка EN под абзацем показывает его прямо в тексте.
Содержание
Введение
Метаданные, связанные с компьютерным файлом, которые определяют поведение файловой системы. Атрибуты файлов — это тип метаданных, описывающих и, возможно, изменяющих поведение файлов и/или каталогов в файловой системе. Типичные атрибуты файла могут, например, указывать, видим ли файл, может ли он быть изменен, сжат или зашифрован. Доступность большинства атрибутов файлов зависит от поддержки базовой файловой системы (например, FAT, NTFS, ext4), где данные атрибутов должны храниться вместе с другими управляющими структурами. Каждый атрибут может находиться в одном из двух состояний: установлен или снят. Атрибуты рассматриваются отдельно от других метаданных, таких как даты и время, расширения имен файлов или разрешения файловой системы. Помимо файлов, атрибуты могут иметь папки, тома и другие объекты файловой системы.
Metadata associated with computer file that define file system behavior
File attributes are a type of meta data that describe and may modify how files and/or directories in a filesystem behave. Typical file attributes may, for example, indicate or specify whether a file is visible, modifiable, compressed, or encrypted. The availability of most file attributes depends on support by the underlying filesystem (such as FAT, NTFS, ext4)
where attribute data must be stored along with other control structures. Each attribute can have one of two states: set and cleared. Attributes are considered distinct from other metadata, such as dates and times, filename extensions or file system permissions. In addition to files, folders, volumes and other file system objects may have attributes.
Unix и POSIX
В Unix и Unix-подобных системах, включая системы, соответствующие стандарту POSIX, каждый файл имеет 'режим', содержащий 9 битов флагов, управляющих разрешениями на чтение, запись и выполнение для владельца файла, группы и всех остальных пользователей (см. Разрешения файловой системы § Традиционные Unix-разрешения для получения более подробной информации), а также флаги setuid и setgid и 'sticky' бит. Режим также определяет тип файла (обычный файл, каталог или другой специальный тип).
In Unix and Unix like systems, including POSIX conforming systems, each file has a 'mode' containing 9 bit flags controlling read, write and execute permission for each of the file's owner, group and all other users (see File system permissions §Traditional Unix permissions for more details) plus the setuid and setgid bit flags and a 'sticky' bit flag. The mode also specifies the file type (regular file, directory, or some other special kind).
Линукс
Операционная система Linux может поддерживать широкий спектр атрибутов файлов, которые можно перечислить с помощью команды lsattr и изменить, где это возможно, с помощью команды chattr. Программы могут изучать и изменять атрибуты, используя операции ioctl. Многие файловые системы Linux поддерживают только ограниченный набор атрибутов, и ни одна из них не поддерживает все атрибуты, которые может изменить chattr. Файловые системы, поддерживающие хотя бы некоторые атрибуты, включают ext4, XFS и btrfs. + Общие атрибуты файлов, поддерживаемые многими распространенными файловыми системами Linux.
The Linux operating system can support a wide range of file attributes that can be listed by the lsattr command and modified, where possible, by the chattr command. Programs can examine and alter attributes using ioctl operations. Many Linux file systems support only a limited set of attributes, and none of them support every attribute that chattr can change. File systems that support at least some attributes include ext4, XFS and btrfs. + Common file attributes supported by many common Linux file systemsAttribute flag optionSemantics and rationaleNo atime updatesA+A, A record is not modified when file is read/accessed. Append onlya+a, aWriting to file only allowed in append mode. Immutablei+i, iPrevents any change to file's contents or metadata: file/directory cannot be written to, deleted, renamed, or hard linked. No dumpd+d, dFile is skipped by the programSecure deletions+s, sRequests that, when deleted, all file data blocks are filled with zeroes. Synchronous updatesS+S, SChanges are written synchronously to the underlying filesystem storage medium; equivalent to 'sync' mount option for affected files.
Опция флага атрибута | Семантика и обоснование
---|---
Нет обновлений времени доступа | A+A, Запись времени доступа не изменяется при чтении/открытии файла.
Только добавление | a+a, Запись в файл разрешена только в режиме добавления.
Неизменяемый | i+i, iПредотвращает любое изменение содержимого файла или метаданных: файл/каталог нельзя перезаписать, удалить, переименовать или создать жесткую ссылку.
Не включать в резервное копирование | d+d, dФайл исключается из программы резервного копирования.
Безопасное удаление | s+s, sЗапрашивает, чтобы при удалении все блоки данных файла были заполнены нулями.
Синхронные обновления | S+S, SИзменения синхронно записываются на базовый носитель файловой системы; эквивалентно опции монтирования 'sync' для затронутых файлов.
The Linux operating system can support a wide range of file attributes that can be listed by the lsattr command and modified, where possible, by the chattr command. Programs can examine and alter attributes using ioctl operations. Many Linux file systems support only a limited set of attributes, and none of them support every attribute that chattr can change. File systems that support at least some attributes include ext4, XFS and btrfs. + Common file attributes supported by many common Linux file systemsAttribute flag optionSemantics and rationaleNo atime updatesA+A, A record is not modified when file is read/accessed. Append onlya+a, aWriting to file only allowed in append mode. Immutablei+i, iPrevents any change to file's contents or metadata: file/directory cannot be written to, deleted, renamed, or hard linked. No dumpd+d, dFile is skipped by the programSecure deletions+s, sRequests that, when deleted, all file data blocks are filled with zeroes. Synchronous updatesS+S, SChanges are written synchronously to the underlying filesystem storage medium; equivalent to 'sync' mount option for affected files.
OpenSolaris и производные
В 2007 году в OpenSolaris была добавлена поддержка "системных атрибутов" (в которых операционная система определяет значение, в отличие от общих расширенных атрибутов файлов) для поддержки сервера CIFS. Эта поддержка была перенесена в релизы Oracle Solaris 11 и проект illumos с открытым исходным кодом. В данной реализации широкий спектр атрибутов может быть установлен с помощью команды chmod и просмотрен командой ls. Программы могут исследовать и изменять атрибуты, используя функции getattrat и setattrat. В настоящее время файловая система ZFS поддерживает все определенные атрибуты, а начиная с Oracle Solaris 11.2, файловая система tmpfs поддерживает их подмножество. + Общие атрибуты файлов, поддерживаемые Oracle Solaris и illumos:
Support for "system attributes" (in which the operating system defines the meaning, unlike general extended file attributes) was added to OpenSolaris in 2007 in support of the CIFS server. It has been carried forward from there into both the Oracle Solaris 11 releases and the open source illumos project. In this implementation, a wide range of attributes can be set via the chmod command and listed by the ls command. Programs can examine and alter attributes using the getattrat and setattrat functions. Currently the ZFS file system supports all defined attributes, and starting in Oracle Solaris 11.2, the tmpfs file system supports a subset of attributes. + Common file attributes supported by Oracle Solaris and illumos systemsAttributeCompact flag for & Semantics and rationaleappendonlyaWriting to file only allowed in append mode. immutableiPrevents any change to file's contents or metadata (except access time): file/directory cannot be written to, deleted, or renamed. nodumpdFile should be skipped by backup programsnounlinkuPrevents removing the file, but allows other changes.
AttributeCompact флаг для & Semantics и rationale
appendonly – Запись в файл разрешена только в режиме добавления.
immutable – Предотвращает любые изменения содержимого файла или метаданных (за исключением времени доступа): файл/каталог нельзя перезаписать, удалить или переименовать.
nodump – Файл должен быть исключен из программ резервного копирования.
nounlink – Запрещает удаление файла, но разрешает другие изменения.
Support for "system attributes" (in which the operating system defines the meaning, unlike general extended file attributes) was added to OpenSolaris in 2007 in support of the CIFS server. It has been carried forward from there into both the Oracle Solaris 11 releases and the open source illumos project. In this implementation, a wide range of attributes can be set via the chmod command and listed by the ls command. Programs can examine and alter attributes using the getattrat and setattrat functions. Currently the ZFS file system supports all defined attributes, and starting in Oracle Solaris 11.2, the tmpfs file system supports a subset of attributes. + Common file attributes supported by Oracle Solaris and illumos systemsAttributeCompact flag for & Semantics and rationaleappendonlyaWriting to file only allowed in append mode. immutableiPrevents any change to file's contents or metadata (except access time): file/directory cannot be written to, deleted, or renamed. nodumpdFile should be skipped by backup programsnounlinkuPrevents removing the file, but allows other changes.