Who initiated chattr and linuxchattr for linux security O & M?
Security has always been a common issue. Let's talk about it today.Chattr.
If any infringement is involved: ContactW18030432178@outlook.com, I will delete the post as soon as possible
Directory 0. chattr introduction 0.0 chattr command introduction 0.1 chattr locking a directory 0.2 Test 1. write script 1.0 write 1.1 Test 2. practice 2.0 modify chattr name 2.1 create soft connection 2.2 Test 3. summary
0. chattrOverview
0.0ChattrCommand Introduction
Introduction: http://www.360doc.com/content/10/1118/21/1317564_70529221.shtml
0.1 chattrLock a directory
[root@www ~]# chattr +i /etc/passwd
0.2Test
[root@www ~]# useradd 123
1.Write scripts
1.0Script Writing(Path::/Service/script/chattr. sh)
# Use/bin/bash to execute the script (the same is true by default )#! /Bin/bash # script introduction (description) # chattr: prohibit the use of chattr and send mail to wl # Script Creation Time # Mon Aug 1 21:06:43 CST 2016 # import PATH File PATH =/usr/local/bin: /usr/bin:/usr/local/sbin:/usr/sbin: /home/wl/bin # set the current environment to take effect export PATH # define the variable USER_NAME to store information USER_NAME =$ (who-u am I) # input the obtained information to/service/script/ChattrWarning. conf echo-e "$ USER_NAME">/service/script/ChattrWarning. conf # Send a mail to wl, whose content is/service/script/ChattrWarning. conf mail-s "chattr warning" wl </service/script/ChattrWarning. conf
Script directory:
[root@www script]# pwd
1.1Test
[root@www script]# /service/script/chattr.sh [root@www script]# cat /service/script/ChattrWarning.conf
2.Practice
2.0ModifyChattrName
root@www script]# mv /usr/bin/chattr /usr/bin/rend
2.1Create a soft connection
[Root @ www ~] # Ln-s/service/script/chattr. sh/usr/bin/chattr ))
2.2Test
[root@www bin]# useradd 123 useradd: cannot open /etc/passwd [root@www bin]# cha chacl chage chattr [root@www bin]# chattr /etc/passwd
Log on to the user who needs to receive the email again. Mine isWl
[Wl @ www ~] $ Mail Heirloom Mail version 12.4 7/29/08. Type? For help. "/var/spool/mail/wl ": 1 message 1 unread> U 1 root Mon Aug 1 19/642 "chattr warning" & 1 (input 1 here is actually the top view (> U 1 root Mon Aug 1 19/642) "chattr warning ))
[wl@www ~]$ cat /service/script/ChattrWarning.conf
3.Summary
In fact, it is very simple to make a thing, but if you want to compile it, it will seem a little difficult. I would like to thank a few books here
0.Laruence'sLinuxPrivate foodBasic LearningClassicMy version is the third edition(I really want to support the genuine books of laruence, but it is too expensive. I can only buy some valuable books if I have money)
1.Learning from old boysLinuxO & MWebCluster practiceClassic books have a poor foundation. Reading this book is difficult, but I think it is very good, but it is too expensive. I can only buy it in a certain treasure.
2.High PerformanceLinuxServer construction practicesClassic in the classic, the design is very wide, very practical, bedside books are the best choice, helpless, student party, only a treasure, if you have money, you must purchase this genuine book
Write a few concluding remarks:
0.Rich and knowledgeable,If you are interested, you can achieve it.
1.Take the simplest job seriously and do the simplest and most bitter thing well.
2.A person may not be smart, but must have an attitude to do things.
3.Suffering should not be the obstacle to success, but the motive force for pushing forward
4.If you like to do one thing, do it not because of money.
5.The letter to Garcia is really a deep article. I want to be a person like Luo Wen.
Time: 23:51:28
Name: Wang Li
Mail: w18030432178@outlook.com