Contents
What does chattr command do in Linux?
The chattr command in Linux is a file system command which is used for changing the attributes of a file in a directory. The primary use of this command is to make several files unable to alter for users other than the superuser.
How do I set attributes in Linux?
You can use the chattr command to change file attributes in Linux. You can secure your files by modifying their attributes. For example, you can protect important system files by making them undeletable.
What is lsattr in Linux?
DESCRIPTION top. lsattr lists the file attributes on a second extended file system. See chattr(1) for a description of the attributes and what they mean.
How do I see all attributes in Linux?
You can list the attribute of the contents of a particular directory with lsattr command followed with a file or directory name as the argument. As the ls -l command, the -d option with lsattr will list the attributes of the directory itself instead of the files in that directory.
How to make a file immutable in Linux?
How to make a file immutable on Linux 1 Immutable Attribute. To make a file immutable, you can add immutable attribute to the file as follows. 2 Append Only Attribute. Another useful attribute is append-only attribute which forces a file to grow only. 3 Conclusion.
How to set or unset immutable attribute on a file?
Note that you must use root privilege to set or unset immutable attribute on a file. Now verify that immutable attribute is added to the file successfully. Once the file is set immutable, this file is impervious to change for any user.
Why are directories with immutable bit sets more confusing?
I am looking to understand how a directory with the immutable bit set behaves on Linux. It is straightforward with files, but the nature of directories having two sides to themselves—the directories themselves and their contents—makes it more confusing. Let’s say I had a directory that looked like this:
How to make a file undeletable in Linux?
Objective: Make a file undeletable or immutable on Linux. Extended file attributes allow a user to set certain attributes of a file residing on a Linux file system. Extended file attributes support is based on the file system and on Linux, the default ext (ext2, ext3, ext4) file systems have support for extended file attributes.