• Skip to main content

Uly.me

cloud engineer

  • Home
  • About
  • Archives

attribute

Set Immutable Attribute

November 27, 2019

If you don’t want a file edited or deleted, you can set the immutable attribute to ON. If activated, not even root or the owner of the file can delete it. Users with write access can still read it, but they obviously will not be able to modify it. To unset it, just use the -i option.

# Set immutable attribute
sudo chattr +i text.txt
 
# Unset immutable attribute
sudo chattr -i text.txt

# Set immutable attribute sudo chattr +i text.txt # Unset immutable attribute sudo chattr -i text.txt

Filed Under: Linux Tagged With: attribute, delete, immutable, read, root, write

  • Home
  • About
  • Archives

Copyright © 2023