Use the Attribute (attrib) utility to set NSS file system directory and file attributes on Linux.
attrib [options] [filename]
If both the set and clear options are selected, the clear option is completed before the set option. If the filename is not specified, the operation is completed on the current directory.
Option |
Description |
---|---|
-s, --set=ATTRIBUTES |
Set the attributes on the file. |
-c, --clear=[ATTRIBUTES | all] |
Clear the attributes on the file. |
-l, --long |
Displays a long version of the file attributes. |
-q, --quiet |
Does not display any normal output. |
-d, --dos |
Use DOS compatible attributes (that is, ro=ro,di,ri) |
-v, --version |
Displays the program version information. |
-h, --help |
Displays the ATTRIB help screen. |
-S, --softlink |
Do not follow link option. |
-r, --recursive |
Set the attributes recursively on the directory. |
Multiple attributes are separated with commas.
Attribute |
Description |
Applies to Files |
Applies to Directories |
---|---|---|---|
aa |
Attribute Archive identifies that a file’s metadata has been modified since the last backup. This attribute is assigned automatically. |
Yes |
No |
all |
All (used only for the Clear option) represents all attributes that can be modified. |
Yes |
Yes |
ar |
Archive identifies files that have modified content since the last backup. This attribute is assigned automatically. |
Yes |
No |
cc |
Cannot Compress (status display only) displays if the file cannot be compressed because of limited space savings. |
Yes |
No |
ci |
Copy Inhibit prevents users from copying a file. This attribute overrides the Read and File Scan trustee rights. This attribute works only for clients using Macintosh operating systems to access NSS volumes on NetWare. |
Yes |
No |
cm |
Compressed (status display only) indicates whether the file is currently stored in compressed format. |
Yes |
No |
dc |
Don’t Compress keeps data from being compressed. This attribute overrides settings for automatic compression of files not accessed within a specified number of days. |
Yes |
No |
di |
Delete Inhibit prevents users from deleting a directory or file. This attribute overrides the Erase trustee right. When it is enabled, no one, including the owner and network administrator, can delete the directory or file. A trustee with the Modify right must disable this right to allow the directory or file to be deleted. |
Yes |
Yes |
ex |
Execute indicates program files, such as .exe or .com files. |
Yes |
No |
hi |
Hidden hides directories and files so they do not appear in a file manager or directory listing. |
Yes |
Yes |
ic |
Immediate Compression sets data to be compressed as soon as a file is closed. If applied to a directory, every file in the directory is compressed as each file is closed. The files in the specified directory are compressed as soon as the operating system can perform the operation after the file is closed. This does not apply to the directory’s subdirectories and the files in them. |
Yes |
Yes |
ip |
Immediate Purge flags a directory or file to be erased from the system as soon as it is deleted. Purged directories and files cannot be recovered. |
Yes |
Yes |
ln |
Link (status display only) indicates a symbolic link (soft link). |
Yes |
No |
mg |
Migrated (status display only) displays if the file or directory is migrated to near-line media. |
Yes |
Yes |
mi |
Migrate Inhibit prevents directories and files from being migrated from the server’s disk to a near-line storage medium. |
Yes |
Yes |
ri |
Rename Inhibit prevents the file or directory name from being modified. |
Yes |
Yes |
ro |
Read Only prevents a file from being modified. |
Yes |
No |
sd |
Subdirectory (status display only) indicates that the entry is a directory, not a file. |
No |
Yes |
sh |
Shareable allows more than one user to access the file at the same time. This attribute is usually used with Read Only. |
Yes |
No |
sy |
System hides the directory or file so it does not appear in a file manager or directory listing. This attribute is normally used with system files. |
Yes |
Yes |
tr |
Transactional allows a file to be tracked and protected by the Transaction Tracking System (TTS). |
Yes |
No |
vo |
Volatile indicates that a file can change without being written to so that opportunistic locks cannot be set on it. |
Yes |
No |
attrib /designs/topsecret -c=all -s=ro,di
This command clears all attributes, then sets Read Only and Delete Inhibit on the /designs/topsecret file.