Tech Junkie Blog - Real World Tutorials, Happy Coding!: Linux Commands: chattr command

Monday, June 21, 2021

Linux Commands: chattr command

 The chattr command in Linux is one of the more useful commands that you've probably used but have no idea what it's use is, it just works!  That's probably the most dangerous phrase in IT.  Well just from the command you can tell that controls the file modify attribute of the file.  Well not really I mean how is chattr related to file attributes.  I guess it's change attribute.  It's pretty easy to use + means to add an attribute, - means to remove an attribute, and = means you want to assign an attribute.  You can also add attributes with the -R option to reclusively on a directory.

One of the senario I used often is when I want to make a file immutable, I'll just type chattr +i filename.  For instance if I and setting a DNS server and I don't want the DHCP scripts to change the resolv.conf file every time I restart the NetworkManager.service I would just type chattr +i /etc/resolv.conf to make the file immutable.  If I try to modify the file I would get the following error message saying I can't modify the file.



It's just as easy to make it writable again, it would just be chattr -i /etc/resolv.conf

14 comments:

  1. Hello! This is my first visit to your blog! We are a group of volunteers and starting a
    new initiative in a community in the same niche. Your blog provided us
    valuable information to work on. You have done a marvellous
    job!
    스포츠토토티비

    ReplyDelete
  2. Excellent site you've got here.. It's hard to find high-quality writing like yours nowadays. 바카라사이트
    I seriously appreciate individuals like you! Take care!!

    ReplyDelete
  3. I’m not that much of a online reader to be honest but your sites really nice, 스포츠토토 keep it up!
    I’ll go ahead and bookmark your site to come back down the road.
    Cheers

    ReplyDelete
  4. It’s so good and so awesome. I am just amazed. I hope that you continue to do your work like this in the future also.
    바카라사이트

    ReplyDelete
  5. I really like it when people come together and share ideas.
    Great website, keep it up! 토토사이트

    ReplyDelete
  6. I like the efforts you have put in this, appreciate it for all the great blog posts. 경마사이트

    ReplyDelete
  7. Nice information. I’ve bookmarked your site, and I’m adding your RSS feeds to my Google account to get updates instantly.
    파친코사이트

    ReplyDelete
  8. Incredible thing. Magnificent subtleties you have talked about likewise check this 스포츠토토


    ReplyDelete
  9. You made some good points there. I did a Google search about the topic and found most people will believe your blog. 메이저사이트

    ReplyDelete
  10. It appears as if some of the written text on your content are running off the screen. 바카라사이트

    ReplyDelete
  11. I finally found what I was looking for! I'm so happy. 사설토토사이트 Your article is what I've been looking for for a long time. I'm happy to find you like this. Could you visit my website if you have time? I'm sure you'll find a post of interest that you'll find interesting.

    ReplyDelete
  12. I am so happy to read this. This is the kind of manual that needs to be given and not the random misinformation that’s at the other blogs. Appreciate your sharing this greatest doc. 메이저토토

    ReplyDelete
  13. Great beat ! I wish to apprentice while you amend your web site, how can i subscribe for a blog website?
    The account helped me a acceptable deal. I had been a little bit acquainted of
    this your broadcast offered bright clear concept
    english stories english short stories with moral value What is the factorial of 100

    ReplyDelete

Search This Blog