Sometimes, files are deleted or changed by accidents such as software update or a typo in a command. To protect a file from being altered by such an accident, it can be set to be immutable even a root user cannot delete or edit it.
The command to set the file immutable is below.
chattr +i filename
Only a root user can execute this command. It changes the immutable attribute of a file. Use this command to view what attributes of a file are set.
isattr filename
To unset the immutable attribute of a file:
chattr -i filename
Reference:
1. chattr - linux man page
2. chattr
--------------------------------------------------------------------------------------------------------------
If you have ever asked yourself these questions, this is the book for you. What is the meaning of life? Why do people suffer? What is in control of my life? Why is life the way it is? How can I stop suffering and be happy? How can I have a successful life? How can I have a life I like to have? How can I be the person I like to be? How can I be wiser and smarter? How can I have good and harmonious relations with others? Why do people meditate to achieve enlightenment? What is the true meaning of spiritual practice? Why all beings are one? Read the book free here.
The command to set the file immutable is below.
chattr +i filename
Only a root user can execute this command. It changes the immutable attribute of a file. Use this command to view what attributes of a file are set.
isattr filename
To unset the immutable attribute of a file:
chattr -i filename
Reference:
1. chattr - linux man page
2. chattr
--------------------------------------------------------------------------------------------------------------
If you have ever asked yourself these questions, this is the book for you. What is the meaning of life? Why do people suffer? What is in control of my life? Why is life the way it is? How can I stop suffering and be happy? How can I have a successful life? How can I have a life I like to have? How can I be the person I like to be? How can I be wiser and smarter? How can I have good and harmonious relations with others? Why do people meditate to achieve enlightenment? What is the true meaning of spiritual practice? Why all beings are one? Read the book free here.
No comments:
Post a Comment