File attributes are a type of metadata 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.
Traditionally, in DOS and Microsoft Windows, files and folders accepted four attributes: [1] [2] [3]
dir
and Windows apps like File Explorer do not show hidden files by default, unless asked to do so. [4] dir
and Windows apps like File Explorer do not show system files by default even when hidden files are shown, unless asked to do so.As new versions of Windows came out, Microsoft has added to the inventory of available attributes on the NTFS file system, [7] including but not limited to: [8]
Other attributes that are displayed in the "Attributes" column of Windows Explorer [7] include:
In DOS, OS/2 and Windows, the attrib
command in cmd.exe and command.com can be used to change and display the four traditional file attributes. [3] [9] File Explorer in Windows can show the seven mentioned attributes but cannot set or clear the System attribute. [5] Windows PowerShell, which has become a component of Windows 7 and later, features two commands that can read and write attributes: Get-ItemProperty
and Set-ItemProperty
. [10] To change an attribute on a file on Windows NT, the user must have appropriate file system permissions known as Write Attributes and Write Extended Attributes. [11]
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).
In 4.4BSD and 4.4BSD-Lite, files and directories (folders) accepted four attributes that could be set by the owner of the file or the superuser (the "User" attributes) and two attributes that could only be set by the superuser (the "System" attributes): [12]
FreeBSD added some additional attributes, [13] also supported by DragonFly BSD: [14]
FreeBSD also supports: [13]
whereas DragonFly BSD supports: [14]
NetBSD added another attribute, [15] also supported by OpenBSD: [16]
macOS added three attributes:
In these systems, the chflags
and ls
commands can be used to change and display file attributes. To change a "user" attribute on a file in 4.4BSD-derived operating systems, the user must be the owner of the file or the superuser; to change a "system" attribute, the user must be the superuser.
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. [18]
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.
Attribute | lsattr flag | chattr option | Semantics and rationale |
---|---|---|---|
No atime updates | A | +A,-A | atime record is not modified when file is read/accessed. |
Append-only | a | +a,-a | Writing to file only allowed in append mode. |
Immutable | i | +i,-i | Prevents any change to file's contents or metadata: file/directory cannot be written to, deleted, renamed, or hard-linked. |
No dump | d | +d,-d | File is skipped by the dump program |
Secure deletion | s | +s,-s | Requests that, when deleted, all file data blocks are filled with zeroes. |
Synchronous updates | S | +S,-S | Changes are written synchronously to the underlying filesystem storage medium; equivalent to 'sync' mount option for affected files. |
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. [19] 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 [20] [21] and listed by the ls
command. [22] [23] Programs can examine and alter attributes using the getattrat
and setattrat
functions. [24] [25]
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. [26]
Attribute | Compact flag for ls & chmod | Semantics and rationale |
---|---|---|
appendonly | a | Writing to file only allowed in append mode. |
immutable | i | Prevents any change to file's contents or metadata (except access time): file/directory cannot be written to, deleted, or renamed. |
nodump | d | File should be skipped by backup programs |
nounlink | u | Prevents removing the file, but allows other changes. |
NT File System (NTFS) is a proprietary journaling file system developed by Microsoft in the 1990s.
Disk partitioning or disk slicing is the creation of one or more regions on secondary storage, so that each region can be managed separately. These regions are called partitions. It is typically the first step of preparing a newly installed disk after a partitioning scheme is chosen for the new disk before any file system is created. The disk stores the information about the partitions' locations and sizes in an area known as the partition table that the operating system reads before any other part of the disk. Each partition then appears to the operating system as a distinct "logical" disk that uses part of the actual disk. System administrators use a program called a partition editor to create, resize, delete, and manipulate the partitions. Partitioning allows the use of different filesystems to be installed for different kinds of files. Separating user data from system data can prevent the system partition from becoming full and rendering the system unusable. Partitioning can also make backing up easier. A disadvantage is that it can be difficult to properly size partitions, resulting in having one partition with too much free space and another nearly totally allocated.
An 8.3 filename is one that obeys the filename convention used by old versions of DOS and versions of Microsoft Windows prior to Windows 95 and Windows NT 3.5. It is also used in modern Microsoft operating systems as an alternate filename to the long filename, to provide compatibility with legacy programs. The filename convention is limited by the FAT file system. Similar 8.3 file naming schemes have also existed on earlier CP/M, TRS-80, Atari, and some Data General and Digital Equipment Corporation minicomputer operating systems.
In computer security, an access-control list (ACL) is a list of permissions associated with a system resource. An ACL specifies which users or system processes are granted access to resources, as well as what operations are allowed on given resources. Each entry in a typical ACL specifies a subject and an operation. For instance,
In computing, a symbolic link is a file whose purpose is to point to a file or directory by specifying a path thereto.
A home directory is a file system directory on a multi-user operating system containing files for a given user of the system. The specifics of the home directory are defined by the operating system involved; for example, Linux / BSD (FHS) systems use /home/⟨username⟩
or /usr/home/⟨username⟩
and Windows systems since Windows Vista use \Users\⟨username⟩
.
fstab is a system file commonly found in the directory /etc
on Unix and Unix-like computer systems. In Linux, it is part of the util-linux package. The fstab file typically lists all available disk partitions and other types of file systems and data sources that may not necessarily be disk-based, and indicates how they are to be initialized or otherwise integrated into the larger file system structure.
These tables provide a comparison of operating systems, of computer devices, as listing general and technical information for a number of widely used and currently available PC or handheld operating systems. The article "Usage share of operating systems" provides a broader, and more general, comparison of operating systems that includes servers, mainframes and supercomputers.
In computing, a file system or filesystem governs file organization and access. A local file system is a capability of an operating system that services the applications running on the same computer. A distributed file system is a protocol that provides file access between networked computers.
DTrace is a comprehensive dynamic tracing framework originally created by Sun Microsystems for troubleshooting kernel and application problems on production systems in real time. Originally developed for Solaris, it has since been released under the free Common Development and Distribution License (CDDL) in OpenSolaris and its descendant illumos, and has been ported to several other Unix-like systems.
Most file systems include attributes of files and directories that control the ability of users to read, change, navigate, and execute the contents of the file system. In some cases, menu options or functions may be made visible or hidden depending on a user's permission level; this kind of user interface is referred to as permission-driven.
rm
is a basic command on Unix and Unix-like operating systems used to remove objects such as computer files, directories and symbolic links from file systems and also special files such as device nodes, pipes and sockets, similar to the del
command in MS-DOS, OS/2, and Microsoft Windows. The command is also available in the EFI shell.
In computing, privilege is defined as the delegation of authority to perform security-relevant functions on a computer system. A privilege allows a user to perform an action with security consequences. Examples of various privileges include the ability to create a new user, install software, or change kernel functions.
In computing, the sticky bit is a user ownership access right flag that can be assigned to files and directories on Unix-like systems.
Extended file attributes are file system features that enable users to associate computer files with metadata not interpreted by the filesystem, whereas regular attributes have a purpose strictly defined by the filesystem. Unlike forks, which can usually be as large as the maximum file size, extended attributes are usually limited in size to a value significantly smaller than the maximum file size. Typical uses include storing the author of a document, the character encoding of a plain-text document, or a checksum, cryptographic hash or digital certificate, and discretionary access control information.
The following tables compare general and technical information for a number of file systems.
In computing, a hidden folder or hidden file is a folder or file which filesystem utilities do not display by default when showing a directory listing. They are commonly used for storing user preferences or preserving the state of a utility and are frequently created implicitly by using various utilities. They are not a security mechanism because access is not restricted – usually the intent is simply to not "clutter" the display of the contents of a directory listing with files the user did not directly create.
The NTFS file system defines various ways to redirect files and folders, e.g., to make a file point to another file or its contents without making a copy of it. The object being pointed to is called the target. Such file is called a hard or symbolic link depending on a way it's stored on the filesystem.
chattr is the command in Linux that allows a user to set certain attributes of a file. lsattr is the command that displays the attributes of a file.