Table of Contents
How to set Linux to not allow permission changes
Home Operation and Maintenance Linux Operation and Maintenance How to set linux not to allow permission changes

How to set linux not to allow permission changes

May 23, 2022 pm 04:28 PM
linux

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".

How to set linux not to allow permission changes

#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

chattr [-RV][-v<版本编号>][+/-/=<属性>][文件或目录...]

Copy after login

Parameters

 -R Recursive processing, processing all files and subdirectories in the specified directory together.

 -v Set the file or directory version.

 -V displays the instruction execution process.

  Turn on this attribute of the file or directory.

 - Turn off the attribute of the file or directory.

 = Specify the attribute of the file or directory.

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.

How to set linux not to allow permission changes

Next, remove the i permission and enter in xshell, chattr -i filename. as the picture shows.

How to set linux not to allow permission changes

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.

How to set linux not to allow permission changes

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!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Unable to log in to mysql as root Unable to log in to mysql as root Apr 08, 2025 pm 04:54 PM

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.

Can mysql run on android Can mysql run on android Apr 08, 2025 pm 05:03 PM

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 terminal Unable to access mysql from terminal Apr 08, 2025 pm 04:57 PM

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.

What is the most use of Linux? What is the most use of Linux? Apr 09, 2025 am 12:02 AM

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.

CentOS Interview Questions: Ace Your Linux System Administrator Interview CentOS Interview Questions: Ace Your Linux System Administrator Interview Apr 09, 2025 am 12:17 AM

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.

How to learn Linux basics? How to learn Linux basics? Apr 10, 2025 am 09:32 AM

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.

Key Linux Operations: A Beginner's Guide Key Linux Operations: A Beginner's Guide Apr 09, 2025 pm 04:09 PM

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.

Cannot start mysql in xampp Cannot start mysql in xampp Apr 08, 2025 pm 03:15 PM

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.

See all articles