2

I am trying make a immutable file that is anyone can read only and can't do any modification into it. i.e - No one can write into it or delete it or move it. For this is referred chattr this LINUX command.

chattr +i filename.txt 

This command makes file immutable but if any other person logged into root in linux then he can remove this immutable by

chattr -i filename.txt

So I want to make something script/code/command, anything so when I make file immutable by then only by running these script/code/command then and then only file should be mutable so anyone can modify this, otherwise not.

Also I referred this chattr github code. I came to know that they used ioctl function and flags to mask this file and made immutable but I didn't find anything more except this.

There is another way to do it in Solaris OS by using zfs but it is not working in UBUNTU because of different platform. Is there any way to do it?

Any suggestion or solution appreciated.

Tejas Lotlikar
  • 2,875
  • 5
  • 16
  • 26
Omkar
  • 121
  • 3
  • I don't understand how "running these script/code/command" is conceptually any different from running `chattr -i` and `chattr +i`. Fundamentally there is only one `root` account so any restriction that one person can put in place as root can be removed by anyone else who has root privileges. – steeldriver Dec 23 '19 at 22:44
  • @steeldriver ***You*** didn't understand my question. I know root account can make change but my task is to root account can not make file mutable until someone (Any user or system) run particular ***script/code/command*** . And my task is to write this ***script/code/command*** . – Omkar Dec 24 '19 at 05:26

0 Answers0