Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to prevent a key file from being modified in Linux system

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

In a Linux environment, some important configuration files are not allowed to be modified by anyone, including root users. To prevent accidental deletion or modification, you may need to set the unmodifiable bit (immutable) permission for the file. Let's take the / etc/fstab file as an example, which records the important partition information of the hard disk, which is shown as follows:

[root@localhost ~] # cat / etc/fstab

#

/ etc/fstabCreated by anaconda on Sat Jun 8 16:22:16 2013

#

Accessible filesystems, by reference, are maintained under'/ dev/disk'See man pages fstab (5), findfs (8), mount (8) and/or blkid (8) for more info

#

UUID=3adeaadc-36c6-4b3b-bf99-aca7e6dfc15f / ext4 defaults 1 1

UUID=6a44e4ad-56b4-4877-8da4-e0bc21979b16 / boot ext4 defaults 1 2

UUID=e9ad5c94-6eee-4927-998a-9ce6024be355 / webserver ext4 defaults 1 2

UUID=5879d097-eadb-4ad2-bbb1-1b3323e86192 swap swap defaults 0 0

Tmpfs / dev/shm tmpfs defaults 0 0

Devpts / dev/pts devpts gid=5,mode=620 0 0

Sysfs / sys sysfs defaults 0 0

Proc / proc proc defaults 0 0

We use the chattr command for protection, which is as follows:

[root@localhost ~] # chattr + I / etc/fstab

If you need to modify the file, use the following command:

[root@localhost] # chattr-I / etc/fstab

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report