Is there any way that I create and modify a file/directory from a user user1, and prevent all other users including the root user from accessing/modifying the file(s)/directories?
-
You cannot hide anything from root. Period. The root user has full access to block devices, RAM and everything.Artem S. Tashkinov– Artem S. Tashkinov2023-01-23 14:12:09 +00:00Commented Jan 23, 2023 at 14:12
1 Answer
No, there is no such way. The root has access to everything. That is the whole reason for root's existence.
If you want hide some files from root - create them on USB stick and unplug it once you done working with files. And yes, if during the time that USB is plugged in, root become curious - he would be able to check the files on USB too.
Encrypting files can help somewhat, if to read the document requires a password - the person with root privileges will also need that password to work with files.
Another way - put the files on a network and to access them a person will need to know the files location first. Add here password to the network service, and your local root will not have any control over your files.