Way to protect a file from being deleted, but not from being altered

filespermissions

I want certain files to be able to be altered by myself on my basic account. To me, they are high priority files, with many backups. But we have some young'uns in the house and I don't quite trust them. I feel like they will find a way to delete the files. Is there a way I could hide them, or make them invisible without a command needed to be input from the command line?

Best Answer

Directory permissions:

  • The write bit allows the affected user to create, rename, or delete files within the directory, and modify the directory's attributes
  • The read bit allows the affected user to list the files within the directory
  • The execute bit allows the affected user to enter the directory, and access files and directories inside
  • The sticky bit states that files and directories within that directory may only be deleted or renamed by their owner (or root)

You can save the files under the ownership of root user and thus this will require them to use password before accessing those files.
As said in directory permissions, you can take away 'write bit' and 'execute bit' thus not allowing them to enter directory. only give them read permission so that they can view files without altering and deleting them.
you can learn the use of sticky bit (link here) and disabling alter and delete feature on every file inside that directory

If they have root password then hiding files is only the way to protect your files and root is god of the system, if they have root password, so they are the real god of your system !

Related Question