Level - 0:-
1.To prevent overwriting the king.txt file, you can set the noclobber option in your shell.
# Set the noclobber option to prevent overwriting files
set -o noclobber /root/king.txt2.Make King.txt unwritable using chattr chattr makes king.txt unwritable even for root.
#add the immutable bit to king.txt and /root
chattr +ia /root/king.txt
chattr +ia /root3.Make king.txt a read-only system file, make sure you are root before running the below command.
#the 'ro' makes king.txt a read-only system file.
sudo mount --bind -o ro /root/king.txt /root/king.txt 2>/dev/null1.If you cant overwrite king.txt then someone already set noclobber on king.txt you can unset it by
set +o noclobber /root/king.txtor
echo "USERNAME" >| /root/king.txt2.When you write your username to king.txt and operation not permitted occurs then probably someone used chattr on king.txt or /root, you can easily remove the immutable bit from king.txt by
chattr -ia /root/king.txt
chattr -ia /root3.If read-only system file appears when you write your name in it , then someone mounted it to make king.txt unwritable, some players also mount whole /root,to unmount it
sudo umount -l /root/king.txt
sudo umount -l /rootlevel - 1