Sometimes important files are stored on your computer, and users don't want them to be changed by the system or by others. Setting read and write permissions for this file is one way to protect file security, but this method is not enough. You can create a file as an unchangeable file so you can keep it safe. So how should a Linux system create unchangeable files?
chattr is a Linux command can set or cancel flag file, and its standard file permissions (read, write, execute) are separate. Another command related to this is lsattr, which shows which flags of the file are set. Initially only the EXT file system (EXT2/3/4) supported the flags managed by chattr and lsattr, but many other native Linux filesystems are now supported, such as XFS, Btrfs, ReiserFS, and so on.
In this tutorial, I will demonstrate if you use chattr to make files in Linux unchangeable.
The chattr and lsattr commands are part of the e2fsprogs package, which is pre-installed on all modern Linux distributions.
Basic syntax for chattr
$ chattr [-RVf][operator][flag] file. . .
where the operator can be “+” (add the selected flag to the list of flags), “-” (remove the selected flag from the list of flag bits), Or “=” (force the selected flag bit).
Below are some of the available flags.
a: Can only be opened in append mode.
A: Atime (file access time) cannot be updated.
c: Automatically compressed when written to disk.
C: Turn off “copy when copying”.
i: Cannot be changed.
s: Safely deleted by auto-zeroing. (LCTT Annotation: After the general situation file is deleted, the content will not be modified. If the flag is changed, the original content will be replaced by “0”) Previous 12 Next Page Total 2 Pages
Lantern is a commonly used system monitoring tool, which is mostly used for Mac system and can also
Under Ubuntu system, you can set the shortcut key of the startup program, so you do
In Linux system operation, abnormal traffic and other issues are encountered during security monitor
In the Linux system, to set the boot, it is necessary to implement it through code.
Ubuntu 14.04 steps to install Wine
How to install uGet 2 on Ubuntu
How to install Linux using logwatch
Linux adds custom encryption algorithms to OpenSSL
Linux backup method through shell script
How to use the cut command to intercept file information in Linux
The method of modifying the /etc/profile file in Linux system
What is the Win10 TH2 update card at 44%?
Protect the operating system with Group Policy (1)
How to fix the blue screen when playing games under Win7 64-bit system
Win10 reset this computer is what it means Win10 reset this computer function detailed use tutorial
How to check the size of Win8 Metro installation software
How to close the new version of the input method language bar in Win10
Master teaches you how to restore the NIC driver that comes with XP system