


How to set linux not to allow permission changes
In Linux, you can use the chattr command to set permissions that are not allowed to be changed. This command is used to change file attributes. When the attribute is set to "i", it means that the file or directory must not be changed arbitrarily, that is, it is set Changing permissions is not allowed, the syntax is "chattr u i file or directory".
#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.
How to set Linux to not allow permission changes
Linux chattr command is used to change file attributes.
This command can change the attributes of files or directories stored on the ext2 file system. These attributes have the following 8 modes:
a: Make the file or directory only for additional purposes.
b: Do not update the last access time of the file or directory.
c: Compress the file or directory and store it.
d: Exclude files or directories from dumping operations.
i: Files or directories are not allowed to be changed arbitrarily.
s: Confidentially delete files or directories.
S: Update files or directories instantly.
u: Prevent accidental deletion.
Syntax
1 |
|
Parameters
-R Recursive processing, processing all files and subdirectories in the specified directory together.
-v
-V displays the instruction execution process.
-
=
Examples are as follows:
i: Permissions cannot be modified
Example: chattr u i filename (corresponding folder), then the filename file cannot be modified by anyone, no matter who , if you need to modify it, you need to delete the i permission first, just use chattr -i filename. Check whether the i permission is set on the file using lsattr filename.
First, we use xshell to see if we have i permission. lsattr filename. as the picture shows.
Next, remove the i permission and enter in xshell, chattr -i filename. as the picture shows.
At this time, there is no prompt, but the modification has been successful. Then I went to xftp to modify the permissions and found that it was easy. Usually, in order to prevent files or websites from being invaded by others, we can also add i permissions. Enter in xshell, chattr i filename. as the picture shows. There is also no prompt, but it has been successful.
Recommended learning: Linux video tutorial
The above is the detailed content of How to set linux not to allow permission changes. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



The main reasons why you cannot log in to MySQL as root are permission problems, configuration file errors, password inconsistent, socket file problems, or firewall interception. The solution includes: check whether the bind-address parameter in the configuration file is configured correctly. Check whether the root user permissions have been modified or deleted and reset. Verify that the password is accurate, including case and special characters. Check socket file permission settings and paths. Check that the firewall blocks connections to the MySQL server.

MySQL cannot run directly on Android, but it can be implemented indirectly by using the following methods: using the lightweight database SQLite, which is built on the Android system, does not require a separate server, and has a small resource usage, which is very suitable for mobile device applications. Remotely connect to the MySQL server and connect to the MySQL database on the remote server through the network for data reading and writing, but there are disadvantages such as strong network dependencies, security issues and server costs.

Unable to access MySQL from the terminal may be due to: MySQL service not running; connection command error; insufficient permissions; firewall blocks connection; MySQL configuration file error.

Linux is widely used in servers, embedded systems and desktop environments. 1) In the server field, Linux has become an ideal choice for hosting websites, databases and applications due to its stability and security. 2) In embedded systems, Linux is popular for its high customization and efficiency. 3) In the desktop environment, Linux provides a variety of desktop environments to meet the needs of different users.

Frequently asked questions and answers to CentOS interview include: 1. Use the yum or dnf command to install software packages, such as sudoyumininstallnginx. 2. Manage users and groups through useradd and groupadd commands, such as sudouseradd-m-s/bin/bashnewuser. 3. Use firewalld to configure the firewall, such as sudofirewall-cmd--permanent-add-service=http. 4. Set automatic updates to use yum-cron, such as sudoyumininstallyum-cron and configure apply_updates=yes.

The methods for basic Linux learning from scratch include: 1. Understand the file system and command line interface, 2. Master basic commands such as ls, cd, mkdir, 3. Learn file operations, such as creating and editing files, 4. Explore advanced usage such as pipelines and grep commands, 5. Master debugging skills and performance optimization, 6. Continuously improve skills through practice and exploration.

Linux beginners should master basic operations such as file management, user management and network configuration. 1) File management: Use mkdir, touch, ls, rm, mv, and CP commands. 2) User management: Use useradd, passwd, userdel, and usermod commands. 3) Network configuration: Use ifconfig, echo, and ufw commands. These operations are the basis of Linux system management, and mastering them can effectively manage the system.

There are many reasons why XAMPP fails to start MySQL, including port conflicts, configuration file errors, insufficient system permissions, service dependency issues, and installation issues. The troubleshooting steps are as follows: 1) Check port conflicts; 2) Check configuration files; 3) Check system permissions; 4) Check service dependencies; 5) Reinstall MySQL. Follow these steps and you can find and resolve issues that cause MySQL startup to fail.
