Linux security Transport Koriyuki who moved Chattr

Source: Internet
Author: User

security has always been a commonplace issue, today we're going to talk about chattr .

If you are involved in an infringement issue: please contact [email protected] , I will delete the post as soon as possible

Introduction to Directory 0.chattr 0.0 chattr command 0.1 chattr lock a directory 0.2 Test 1. Script 1.0 Scripting 1.1 Test 2. Practice 2.0 Modify CHATTR name 2.1 Create a soft connection 2.2 test 3. Total Knot

  

0.chattr the introduction
0.0 chattr Command Introduction
  Introduction: http://www.360doc.com/content/10/1118/21/1317564_70529221.shtml

  

 0.1 chattr Lock a directory

[Email protected] ~]# chattr +i/etc/passwd   

  0.2 Test

[Email protected] ~]# Useradd 123

  

1. Scripting

  1.0 Script Writing ( path :/service/script/chattr.sh)

#使用/bin/Bash to execute script (the default is the same) #!/bin/Bash #脚本简介 (description) #chattr: Prohibit the use ofchattrand send mail to WL #脚本创建的时间 #Mon1  +: .: +Cst .#导入PATH文件 PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/wl/bin #设置当前环境生效 Export PATH #定义变量USER_NAME used to store information user_name=$(W.H.O.-u am i) #将获取到的信息定向输入至/service/script/chattrwarning.confEcho-E"$USER _name">/service/script/chattrwarning.conf #发送mail邮件至wl, its content is/service/script/chattrwarning.conf Mail-S"chattr Warning"WL </service/script/chattrwarning.conf

directory where the script is located:

[Email protected] script]# pwd

  

1.1 Test

[Email protected] script]#/service/script/chattr.sh [[email protected] script]# cat/service/script/ Chattrwarning.conf

  

2. Practice

  2.0 Modify chattr name

[Email protected] script]# Mv/usr/bin/chattr/usr/bin/rend

 

  2.1 creating a soft connection

[[email protected] ~]# ln-s/service/script/chattr.sh/usr/bin/chattr (don't mean, the picture has an error (Chattr write wrong cgattr))

  

  2.2 Test

[Email protected] bin]# useradd 123 useradd:cannot open/etc/passwd [[email protected] bin]# cha chacl   chage   chattr [[email protected] bin]# CHATTR/ETC/PASSWD

  

  
re-login the user who needs to receive mail, mine is WL

[Email protected] ~]$ Mail heirloom mail version 12.4 7/29/08.  Type?  For help. "/VAR/SPOOL/MAIL/WL": 1 message 1 unread >u  1 root                  Mon  1 23:21  19/642   "chattr warning" & ; 1 (enter 1 here is actually the top of the view (>u  1 root                  Mon  1 23:21  19/642   "chattr warning" this mail))

  

[Email protected] ~]$ cat/service/script/chattrwarning.conf

3.Summary
actually doing a thing out is very simple, but if you want to write it, it seems a little hard, in this thank a few books
  0."Brother Bird'sLinuxPrivate CuisineBasic Learning article "Classics in the ClassicMy version is the third edition(very want to support bird Brother's genuine books, helpless, is too expensive, only a treasure, if the money, must buy this genuine books)
  1.learn from the old boyLinuxoperation and MaintenanceWebThe actual combat of the clusterClassic books, their foundation is too poor, see this book a little hard, but feel very good, but too expensive, can only buy in a treasure
  2.the high-performanceLinuxServer Build Combat "Classic in the classic, design to a wide range of aspects, very practical, bedside books not two choice, helpless, student party, only a treasure, if rich, must buy this genuine books
 
write a few concluding remarks:

  0.you have self-knowledge.,a person with a ambition is a matter of fact.
  1.take one of the simplest jobs and do the simplest and most painful things.
  2.a person can not be clever, but must have the attitude of doing things
  3.misery should not be a hindrance to success, but a driving force for progress.
  4.do what you like, not because of money .
  5."The letter to Garcia" is really good, I want to be a man like Rowan.

  

Time:2016-08-01 23:51:28

Name: Wang

Mail:[email protected]

Linux security Operations Koriyuki who moved chattr

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.