Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How can we hide a file so no one can see that file even root?
Don't misunderstand what I am going to say, but what you are asking to do is something hackers/crackers would do to cover their tracks. You want steps to hide your script and file(s) from root as well.
You can do what AuroraCA said, create a encrypted private directory or you can create an encrypted tar file. Hiding a .dot directory or .dot file is not that simple, especially from a knowledgeable root user.
Just a word of advice, and I hope you take it constructively. If this is in a work environment, I wouldn't even try to hide things from the administrators. Companies have a habit of feeling very strongly about this sort of thing when they find it. If it's something that doesn't belong on the server, then it simply doesn't belong there. If it's work-safe but you have some valid reason that you don't want anyone to know about it, then I'd discuss it with your supervisor anyway. Maybe he will have a suggestion for you. If it's on a school server, then you should consider the same issues.
If you don't want to tell us why you want to hide something from the root user (AKA the administrator---ie the person who is responsible for the computer), then noone should really be helping you.
Please tell us what you are up to and specifically why you would need to hide something from the administrator.
It is not really possible. The only way to hide them is to rename them with '.' at beginning, but then they are still there and you can list them. To do what you want is not possible, because you would never be able to find them again as anyone. Think about it and maybe you'll understand. If you hide the files and nobody can see them, how do you get them back ? I guess deleting the files would be what you want, that would satisfy all your conditions. Then you could attempt to recover them with something like foremost.
root can do anything though... and an administrator may be able to do anything (depending on if they have a special group or if they have root powers.)
If you are concerned about readability for privacy reasons... you can always just store it on a flash drive.
BUT if you really want to be sneaky AND you have root powers AND you want it to persist
create a swap file (file not partition)
some how restrict the swap system from using it
encrypt the data stream then 'dd' it into the swap space.
This would give you a prealocated space of a predefined amount where you can store and retrieve encrypted data from that is pasted it with any type of format and space you want. Nobody can simply read the swap space short of viewing it in hexadecimal, it's encrypted, and the format is unknown.
the previous post was right though... what you want is something a virus or a hacker would do. Coincidently, this is something windows does on a regular basis with desktop.ini files I guarantee you, the number of desktop.ini files you can find with linux viewing the ntfs partition will outnumber the amount you can find using the gui search in windows. Not to mention the recycling bin! don't get me started on that!
I don't know what do you think you found. But root is root. Period. It can do anything, and that includes seeing every file, and being able to restore and change permissions for any file.
If your concern is privacy, look into encryption. Then you are going to be sure that unless they have your key they can't decrypt the file to look inside. However, that will probably annoy them, and they could just delete any encrypted file they find around without any warning as well.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.